<< 30-12-2020 >>

00:05:30mipriit's just a https://en.wikipedia.org/wiki/Space%E2%80%93time_tradeoff , because I/O syscalls are slow.
00:08:59miprilook at readFile in lib/system/io.nim . there's some overhead to get the size of the file, and then it tries to get the entire file in one read, which probably works up to sizes like 2GB, and then only costs additional reads after that
00:09:16ForumUpdaterBotNew thread by Cmc: Announce: nestegg webm demuxer, dav1d av1 video decoder, opus audio decoder, and lov video player, see https://forum.nim-lang.org/t/7303
00:10:51FromDiscord<Filipe Duarte> How to convert a variable from string to integer inputed by an user?
00:11:06FromDiscord<Recruit_main707> parseInt, from strutils
00:11:11FromDiscord<Recruit_main707> i think thats what you want
00:11:34FromDiscord<Recruit_main707> https://nim-lang.org/docs/strutils.html#parseInt%2Cstring
00:12:05FromDiscord<Filipe Duarte> Yeah! Thanks
00:14:01FromDiscord<Filipe Duarte> `echo "How many particles? "↵var n_particles = readLine(stdin).parseInt()`
00:14:21FromDiscord<Filipe Duarte> (edit) "readLine(stdin).parseInt()`" => "readLine(stdin).parseInt()`↵Worked"
00:14:25FromDiscord<ElegantBeef> That will fail if you pass a non int
00:14:49FromDiscord<Filipe Duarte> hum, so what is the best way?
00:15:13mipriit will successfully throw an exception if oyu pass a non int.
00:16:23FromDiscord<ElegantBeef> Yep, using `try except` is one way of not having the program crash on valid input
00:16:28FromDiscord<ElegantBeef> (edit) "valid" => "invalid"
00:17:11FromDiscord<ElegantBeef> another method would be to use `strscans.scanf` although could be considered sillier
00:19:16FromDiscord<Filipe Duarte> while true try except until the user inputs an integer?
00:19:28*Vladar quit (Quit: Leaving)
00:19:41mipriif that's what you want. I wouldn't want that.
00:20:02mipriI would generally use cligen and avoid interactive input altogether though.
00:20:45mipriit's really pointless to talk about this stuff before you've a specific dissastisfaction with the behavior of some code you've written.
00:21:23miprimaybe an uncaught exception from parseInt is an acceptable behavior for your program, given a non-int
00:23:07*kwilczynski quit (Ping timeout: 260 seconds)
00:23:07*fowl quit (Ping timeout: 260 seconds)
00:24:15FromDiscord<Filipe Duarte> Understand! I'm trying to do simple stuff for learning Nim, but I'm going to study what you've said .. cligen
00:25:01*fowl joined #nim
00:25:09*kwilczynski joined #nim
01:01:36*krux02 quit (Remote host closed the connection)
01:05:45FromDiscord<William_CTO> I'd like to use MongoEngine in nim as it contains all the DB logic I need for my project. How easy is it to work with python modules in nim?
01:06:36FromDiscord<ElegantBeef> Have you seen https://github.com/yglukhov/nimpy
01:08:02FromDiscord<William_CTO> I've been looking at that. I see that it relies on your python installation. Are there ways to use python code without relying on a python runtime?
01:08:15FromDiscord<ElegantBeef> Yea, write it i Nim 😄
01:08:19FromDiscord<ElegantBeef> (edit) "i" => "in"
01:08:31FromDiscord<William_CTO> Ack
01:08:53FromDiscord<William_CTO> Was trying to avoid having to rewrite the business/db logic in nim and python
01:09:03FromDiscord<William_CTO> I'll give nimpy a try
01:10:43FromDiscord<ElegantBeef> I dont know what mangoengine does so no clue if there are any Nim alternatives
01:11:11FromDiscord<William_CTO> its a high level mongo orm for python
01:11:12miprinimble search mongo
01:11:24FromDiscord<William_CTO> there are lower level mongo interfaces for nim
01:11:55FromDiscord<William_CTO> However mongoengine takes care of things like lazy references to other collection documents for me
01:17:37*jjido quit (Quit: Connection closed for inactivity)
01:20:39*Tanger joined #nim
01:24:33*saem_ joined #nim
01:47:50disruptek!repos mongo
01:47:50disbothttps://github.com/mashingan/anonimongo -- 9anonimongo: 11Another Nim pure Mongo DB driver 15 16⭐ 5🍴
01:47:50disbothttps://github.com/nim-lang/mongo -- 9mongo: 11Wrapper for MongoDB 15 9⭐ 1🍴
01:47:50disbothttps://github.com/JohnAD/mongopool -- 9mongopool: 11A pooled library/driver for using MongoDB from a threaded application 15 8⭐ 0🍴 7& 1 more...
01:49:09disrupteki think the benefits of not having to use python outweigh the disadvantages, but it's your call.
02:24:03*vicfred quit (Quit: Leaving)
02:39:08*smitop quit (Quit: Connection closed for inactivity)
02:56:46*cyraxjoe joined #nim
03:17:46*mahlon joined #nim
03:18:26*abm quit (Read error: Connection reset by peer)
03:19:38*vicfred joined #nim
03:20:21*Tlangir joined #nim
03:23:05*Tanger quit (Ping timeout: 256 seconds)
03:23:50FromDiscord<William_CTO> Just wanted to make sure this is a valid range↵`score: range[0.0..1.0]`↵Can you use non-int types?
03:24:02FromDiscord<William_CTO> (edit) "types?" => "types?↵My code compiles and runs so I guess it works"
03:26:03*cyraxjoe quit (Quit: I'm out!)
03:26:10FromDiscord<shadow.> i mean that would be any default float type value from 0.0 to 1.0
03:26:50FromDiscord<William_CTO> Yes, but it also limits it from going above 1
03:28:36*cyraxjoe joined #nim
03:30:03*cyraxjoe quit (Client Quit)
03:35:10*cyraxjoe joined #nim
03:53:35*muffindrake quit (Ping timeout: 272 seconds)
03:55:25*muffindrake joined #nim
04:03:16*a_chou joined #nim
04:03:27*a_chou quit (Remote host closed the connection)
04:05:30FromDiscord<William_CTO> Erm, how do I accept an iterator of type JsonNode as a proc argument?
04:07:13FromDiscord<Rika> does the iterator have the `{.closure.}` pragma
04:07:18FromDiscord<Rika> or are you writing the proc?
04:08:39FromDiscord<William_CTO> I'm writing the proc
04:08:40disrupteki have a bad feeling about this.
04:08:44*mfx joined #nim
04:08:45FromDiscord<William_CTO> Why?
04:09:09FromDiscord<Rika> proc aa(x: iterator(a: JsonNode): ?): ? ...
04:09:12FromDiscord<Rika> does this not work?
04:09:18FromDiscord<Rika> i dont remember if it does actually
04:09:34FromDiscord<William_CTO> sent a code paste, see https://play.nim-lang.org/#ix=2KgS
04:09:44FromDiscord<ElegantBeef> I think you need a template for this
04:10:00FromDiscord<ElegantBeef> Or just use a generic proc that uses the jsonnode
04:10:42*mfx quit (Remote host closed the connection)
04:11:08FromDiscord<William_CTO> @ElegantBeef can you elaborate more?
04:12:10FromDiscord<William_CTO> My end goal is to take a JArray and call `to(JNode, T)` on each item in the JArray. Since the items proc works on JArrays, I figured this was the proper route to go down
04:12:46FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=2KgT like this
04:14:00FromDiscord<ElegantBeef> Items isnt a proc, but an iterator which is where this gets weird
04:14:27FromDiscord<William_CTO> Gosh, thank you for pulling me out of my complicated web
04:14:49FromDiscord<ElegantBeef> That fails silently if it's not an array so probably want to change that
04:15:18FromDiscord<William_CTO> I'm fairly new to Nim and haven't played with exceptions yet
04:15:42FromDiscord<ElegantBeef> It'd just return an empty seq so it's probably fine
04:18:28FromDiscord<William_CTO> How do you call this kind of function?
04:18:40FromDiscord<William_CTO> Rather how do I specify type T?
04:19:17FromDiscord<ElegantBeef> you can do `toSeq[T](jsonNode)` or `jsonNode.toSeq[: T]()`
04:19:28FromDiscord<ElegantBeef> T being your desired type obviously
04:20:39FromDiscord<William_CTO> Why is `: T` required in the second form? And where can I find documentation on this?
04:21:17FromDiscord<ElegantBeef> It's required cause without it it turns into `toSeq([]())` or something similar to that
04:21:31FromDiscord<William_CTO> Thank you for taking the time to answer my questions
04:21:55FromDiscord<ElegantBeef> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
04:50:22*Tlanger joined #nim
04:53:11*Tlangir quit (Ping timeout: 256 seconds)
05:23:52*D_ quit (Ping timeout: 260 seconds)
05:25:14*D_ joined #nim
05:28:35*njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
05:28:44*njoseph joined #nim
05:29:21*njoseph quit (Client Quit)
05:29:30*njoseph joined #nim
05:31:12ForumUpdaterBotNew post on r/nim by Chris3606: ARC/ORC and DLL Requirements, see https://www.reddit.com/r/nim/comments/kmvxmo/arcorc_and_dll_requirements/
05:34:42FromDiscord<Cohjellah> Man going back to Python from Nim... It's actually kind of ugly
05:34:51FromDiscord<Cohjellah> Nim has that next level of elegance
05:50:06FromDiscord<shadow.> exactly
05:50:18FromDiscord<shadow.> static typing and lack of comprehension abuse makes it neater
05:52:00FromDiscord<ElegantBeef> Well also UFCS, proper control of import/export, and non qualified functions 😛
06:03:13FromDiscord<shadow.> yeah that too
06:03:38FromDiscord<shadow.> as well as immutability
06:03:47FromDiscord<shadow.> shows what's important to mutate and what isnt
06:13:44*superbia joined #nim
06:16:04*waleee-cl quit (Quit: Connection closed for inactivity)
06:33:16FromDiscord<William_CTO> I agree Nim is much better than python. I just haven’t ported over all my code yet
06:34:14*Gustavo6046 quit (Ping timeout: 264 seconds)
06:36:17*habamax joined #nim
06:38:26*D_ quit (Ping timeout: 256 seconds)
06:40:02*D_ joined #nim
06:49:51*narimiran joined #nim
06:51:58FromDiscord<CodeHz> question: since initTable is not needed since 0.20, can I use `new Table[...]` instead of `newTable[...]()` for init TableRef ?
06:56:14narimiranyou can use `var a: TableRef[...]`
06:56:28narimiranprobably. maybe. haven't tried it
06:57:06FromDiscord<flywind> !eval var a = new TableRef[int, int]
06:57:08NimBotCompile failed: /usercode/in.nim(1, 13) Error: undeclared identifier: 'TableRef'
06:57:26FromDiscord<ElegantBeef> forgot the import 😄
06:58:06FromDiscord<flywind> !eval import tables; var a = new TableRef[int, int]
06:58:09NimBot<no output>
06:58:18Prestige@ElegantBeef the more I re-read this multiple interitance paper, the more lost I get on the implementation lol
06:58:26FromDiscord<ElegantBeef> that's a ref ref though?
06:58:42PrestigeI might be able to make something super crude
06:59:22FromDiscord<CodeHz> it will create `ref TableRef[...]` not `TableRef[...]` (
06:59:34FromDiscord<ElegantBeef> you seem to be able to do `new Table[T, T2]`
06:59:36FromDiscord<CodeHz> `TableRef[..] ` == `ref Table[...]`
06:59:58FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=1CfZ atleast it seems to "work" 😄
07:00:05saemI've already tried nim dump, no joy. Is there another way I might get what flags were set in the materialized cfg for a nim project?
07:00:09FromDiscord<CodeHz> yes, I think it seems to work
07:00:19FromDiscord<CodeHz> but I don't know if it is correct
07:00:42FromDiscord<ElegantBeef> I mean we have the more proper `newTable` procs for correctness
07:02:32*D_ quit (Quit: No Ping reply in 180 seconds.)
07:02:38FromDiscord<Rika> it is yes
07:02:43FromDiscord<Rika> its correct but not idiomatic
07:03:36*D_ joined #nim
07:04:04FromDiscord<flywind> !eval import tables; var x = new TableRef[int, int]; assert x is TableRef; assert x isnot ref TableRef
07:04:07NimBot<no output>
07:04:47FromDiscord<Rika> !eval import tables; var x = new TableRef[int, int]; echo x is TableRef
07:04:52NimBottrue
07:05:24FromDiscord<CodeHz> !eval import tables; var x = new Table[int, int]; echo x is TableRef
07:05:27NimBottrue
07:05:42FromDiscord<ElegantBeef> Well yea it's going to work
07:05:53FromDiscord<ElegantBeef> `ref T` is made from `new`
07:05:55FromDiscord<CodeHz> so the `ref ref X` is == r`ef X`
07:06:05FromDiscord<CodeHz> oh
07:07:08FromDiscord<CodeHz> but new X is more generic, should work for all "value type"
07:07:37FromDiscord<ElegantBeef> I mean it does work for all value types
07:08:34FromDiscord<ElegantBeef> But it's also not the wisest, since if the object has any initialisation required or is unknowingly a `ref` you now how a `ref ref`
07:08:48FromDiscord<ElegantBeef> (edit) "how" => "have"
07:09:06FromDiscord<Rika> didnt we just establish it doesnt ref ref or what
07:09:15FromDiscord<ElegantBeef> Did you read the entire message?
07:09:32FromDiscord<ElegantBeef> "unknowingly a ref"
07:09:42FromDiscord<CodeHz> https://media.discordapp.net/attachments/371759389889003532/793737559335108638/unknown.png
07:09:54FromDiscord<Rika> yeah
07:09:56FromDiscord<ElegantBeef> Oh you did prove it
07:09:57FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=1LX8
07:09:58FromDiscord<ElegantBeef> I misread
07:09:59FromDiscord<Rika> :facepalm1:
07:10:07FromDiscord<Rika> beef please
07:10:25FromDiscord<Rika> rarely does anyone need a double ref
07:10:30FromDiscord<ElegantBeef> I know
07:10:56FromDiscord<ElegantBeef> Either way it's not very idiomatic as it can make an object not initialised properly
07:11:18FromDiscord<CodeHz> (I think it will be reset to zeros)
07:11:23FromDiscord<ElegantBeef> Exactly
07:11:24FromDiscord<CodeHz> (edit) removed "be"
07:11:25FromDiscord<Rika> that is true
07:11:42FromDiscord<ElegantBeef> That's not always what you want
07:11:42FromDiscord<Rika> not all objects are initialized to 0s desirably
07:13:01FromDiscord<CodeHz> so if `var x: X` is fine, `var y: ref X = new X` is fine too
07:13:12FromDiscord<CodeHz> (edit) "fine," => "fine (without init),"
07:13:18FromDiscord<ElegantBeef> Yes
07:15:58FromDiscord<ElegantBeef> Not that there is any benefit to using `new` over a `newT` proc
07:35:43*leorize quit (Ping timeout: 240 seconds)
07:36:29*leorize joined #nim
07:50:21*disruptek throbs.
07:56:08*saem quit (Remote host closed the connection)
07:56:08*saem_ is now known as saem
08:05:02disrupteksaem: if you want to know what's in the config, you can simply parse the config.
08:06:33*PMunch joined #nim
08:06:56disruptekwhy is ricin so damned expensive?
08:08:49saemdisruptek: I'd have to build a tool and ship that because I can't do that in JS.
08:09:47saemNot the end of the world, just something to keep in mind
08:11:53saemThe thing I really care about is can I do some basic automatic detection of how to fire up a debugger.
08:18:32saemMy current tact is excising as much config as possible from the extension and having the programmer use .cfg and .nims. For now I'll just do it and then see what if any tooling fixes are required and some of it might have to be backported.
08:20:37saemThat fixes one of the biggest issues intrinsic to the extension which is that the default mode is a nimsuggest process per file and annoying/poorly document project and project mapping configs.
08:22:25saemAfter that it goes back to nimsuggest bugs, which are partly from poorly configured nimsuggest instances and after narrowing those it's a bunch of test and fix until IC shows up.
08:29:52*Tlanger quit (Remote host closed the connection)
08:33:45saemThanks for listening to me ted talk
09:06:33*Q-Master joined #nim
09:07:00*^Q-Master^ quit (Read error: Connection reset by peer)
09:07:00*rockcavera quit (Read error: Connection reset by peer)
09:07:07*tiorock joined #nim
09:07:07*tiorock quit (Changing host)
09:07:07*tiorock joined #nim
09:07:07*tiorock is now known as rockcavera
09:11:12*tane joined #nim
09:17:40*nyaa85 joined #nim
09:18:32*nyaa8 quit (Read error: Connection reset by peer)
09:18:32*nyaa85 is now known as nyaa8
09:37:25*zedeus quit (Ping timeout: 240 seconds)
09:39:44*zedeus joined #nim
09:47:55FromDiscord<mratsim> @disruptek, @zevv, my fiber connection which is down since Saturday, and was supposed to be repaired this evening will apparently be down until end of January.↵↵I've been on spotty 4G until now and I'm changing ISP but in the mean time I need to reduce my data consumption so will only ue internet in a very limited way.
09:50:57FromGitter<eagledot> @mratism hey, you active on arraymancer channel right now?
09:51:17Zevvmratsim: luckily there's still IRC in 2020
09:51:58FromGitter<eagledot> :)
09:52:16Zevvwhere your bandwidth roughly equals the actual bandwidth of the information getting transferred
09:53:03Zevvwait, *end* of janauri?
09:53:05ZevvMan
09:55:28*hnOsmium0001 quit (Quit: Connection closed for inactivity)
09:56:59*Vladar joined #nim
10:15:43*tiorock joined #nim
10:15:43*rockcavera quit (Killed (orwell.freenode.net (Nickname regained by services)))
10:15:43*tiorock is now known as rockcavera
10:15:43*rockcavera quit (Changing host)
10:15:43*rockcavera joined #nim
10:23:05ForumUpdaterBotNew thread by Cnerd: Http request using mom's JavaScript backend, see https://forum.nim-lang.org/t/7304
10:28:45*rockcavera quit (Read error: Connection reset by peer)
10:29:05ForumUpdaterBotNew thread by Jiyinyiyong: Any trick to custom varargs implementation in generated js?, see https://forum.nim-lang.org/t/7305
10:29:15*rockcavera joined #nim
10:34:36*disbot quit (Ping timeout: 240 seconds)
10:37:15*vicfred quit (Quit: Leaving)
10:38:02*disbot joined #nim
10:43:48*Q-Master quit (Ping timeout: 260 seconds)
10:51:04*JustASlacker joined #nim
10:51:44JustASlackerhappy easter
10:52:14JustASlackeris there something like a c-style static variable in nim?
10:52:20JustASlackerhttps://en.wikipedia.org/wiki/Static_variable
10:52:32Zevvstatic is ambigious in C
10:52:47JustASlackerlike in the wiki article
10:52:52ZevvI assume you mean {.global.}
10:53:04Zevvhttps://nim-lang.github.io/Nim/manual.html#pragmas-global-pragma
10:53:08FromDiscord<Rika> const if what you mean in the wiki
10:53:17FromDiscord<Rika> or wait
10:53:33JustASlacker{.global.} looks nice
10:53:53FromDiscord<Rika> misinterpreted wiki lol
10:53:58FromDiscord<Rika> yeah its what zevv says
10:54:10Oddmongeris it really global , or just kept in the function scope ?
10:54:23ZevvIt actualyl just compiles to a static in C
10:54:32Oddmongerah nice
10:55:11Zevvhttps://play.nim-lang.org/#ix=2KhG
10:55:31JustASlackervery cool
10:56:20JustASlackerthanks
11:00:20JustASlackerI like the way the regex is build only once using {.global.} pragma
11:01:03JustASlackerBut the regex stays the same. Wouldnt it be better to use let
11:01:33JustASlackeror does that not make sense?
11:01:50ZevvI don't know what regex you are referring to
11:01:59JustASlackerin the example you linked
11:02:03JustASlackerhttps://nim-lang.github.io/Nim/manual.html#pragmas-global-pragma
11:02:23Zevvah in the manual, yes
11:02:31Zevvtrue, no reason for that to be a var, indeed
11:02:45JustASlackerrite, thx
11:09:57FromDiscord<TeiwazCoder> sent a code paste, see https://play.nim-lang.org/#ix=2KhJ
11:13:09FromDiscord<cybertim> sent a long message, see http://ix.io/2KhK
11:14:43*Q-Master joined #nim
11:16:31JustASlackerTeiwazCoder: https://en.wikipedia.org/wiki/Nim_%28programming_language%29#Uniform_Function_Call_Syntax
11:16:35FromDiscord<lqdev> @TeiwazCoder none
11:16:47FromDiscord<lqdev> this is called command call syntax
11:17:01FromDiscord<lqdev> https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax
11:18:20FromDiscord<TeiwazCoder> Thank you, I missed this point.
11:19:25*Q-Master quit (Ping timeout: 246 seconds)
11:20:37FromDiscord<Rika> @cybertim can we see the code?
11:22:16FromDiscord<cybertim> most basic example 😛
11:22:16FromDiscord<cybertim> sent a long message, see http://ix.io/2KhM
11:27:53FromDiscord<Rika> theyre all being handled concurrently for me
11:28:13FromDiscord<cybertim> is it platform dependend?
11:28:36FromDiscord<Rika> how do you compile and load these pages
11:29:18FromDiscord<cybertim> nim r --define:useStdLib file.nim
11:29:34FromDiscord<Rika> same way i do it...
11:29:41FromDiscord<Rika> whats the platform you're using
11:29:47FromDiscord<cybertim> windows
11:29:59FromDiscord<Rika> not within wsl?
11:30:26FromDiscord<cybertim> no, using nim installed with scoop
11:30:39FromDiscord<Rika> let me try that
11:33:07FromDiscord<Rika> still works as expected for me
11:33:18FromDiscord<Rika> how are you loading the pages
11:33:50FromDiscord<cybertim> localhost:5000/ refreshing three tabs in the browser
11:35:22FromDiscord<cybertim> ok, thanks for testing 🙂 i found the issue, wouldn't have thought about it without someone trying this tho
11:35:28FromDiscord<Rika> you're refreshing them all at the same time right?
11:35:49FromDiscord<Rika> oh what was the issue then
11:35:52FromDiscord<cybertim> if i try edge .. it is suddenly doing it one at the time, tried firefox and indeed its concurrent!
11:35:58FromDiscord<Rika> lmao
11:36:09FromDiscord<Rika> edge is weird then
11:36:10FromDiscord<cybertim> this is really strange
11:36:28FromDiscord<Rika> is the console showing that the requests all get there at the same time but finish at different itmes?
11:36:39FromDiscord<cybertim> so days of testing different approaches and it is the webbrowser lol
11:37:36FromDiscord<cybertim> in firefox i see it being called almost the same time, but with edge a call really needs to be resolved before the next request comes in
11:37:42miprior, it's still jester and the problem is some subtle protocol screwup that firefox is more forgiving of.
11:37:54FromDiscord<cybertim> could be..
11:38:32FromDiscord<cybertim> asynchttpserver does the same, so its probably related to that
11:38:39FromDiscord<Rika> no, if the requests arent coming IN at the same time its not jester
11:38:40mipriI see a worse problem with apachebench against your jester example. The page content is received and then ab waits for the rest of it; connections only end when they time out
11:39:09FromDiscord<Rika> try httpbeast then
11:39:18FromDiscord<cybertim> that one doesnt work on windows 😛
11:39:40FromDiscord<Rika> wsl
11:42:05*JustASlacker quit (Ping timeout: 240 seconds)
11:54:02*Q-Master joined #nim
12:22:41FromDiscord<CodeHz> it seems useMalloc also works for ARC , doesn't it? https://media.discordapp.net/attachments/371759389889003532/793816322965241866/unknown.png
12:23:42FromDiscord<CodeHz> https://nim-lang.org/docs/nimc.html#nim-for-embedded-systems it is so confused
12:25:23FromDiscord<Rika> its supposed to work for arc yes
12:25:30FromDiscord<Rika> not updated docs i guess
12:27:32FromDiscord<CodeHz> but what's about other type gc?
12:27:35FromDiscord<CodeHz> like ORC
12:27:59mipriif something works for arc it's going to work for orc.
12:28:03FromDiscord<Rika> orc is just arc with a cycle breaker i believe
12:28:31FromDiscord<CodeHz> no, orc will crash when used with dll(
12:28:43FromDiscord<CodeHz> because nimrtl is broken for arc/orc
12:28:57FromDiscord<CodeHz> and cycle collector need it
12:29:00miprilikewise, if something doesn't work for arc it's not going to work for orc.
12:30:32FromDiscord<CodeHz> but arc works with dll
12:31:07FromDiscord<CodeHz> since it doesn't need cycle collector(
12:31:40FromDiscord<CodeHz> (edit) "but arc works with dll ... " added " with -d:useMalloc"
12:33:00FromDiscord<CodeHz> https://github.com/geekrelief/gdnim/issues/8
12:33:01disbotgc:ORC crashes gdnim with useMalloc
12:35:24*lum quit (Quit: Lum: Bye!)
12:41:30ForumUpdaterBotNew post on r/nim by miran1: Nim in 2020: A short recap, see https://nim-lang.org/blog/2020/12/28/nim-in-2020-a-short-recap.html
12:44:25*FromDiscord quit (Remote host closed the connection)
12:44:40*FromDiscord joined #nim
12:53:31FromDiscord<CodeHz> btw, why nimble.directory not use latest version nim https://media.discordapp.net/attachments/371759389889003532/793824080867753994/unknown.png
12:54:06*saem quit (Quit: Connection closed for inactivity)
12:54:08FromDiscord<CodeHz> (edit) "btw, why nimble.directory ... not" added "does"
12:56:38FromDiscord<CodeHz> (edit) btw, why does nimble.directory not use latest version nim https://media.discordapp.net/attachments/371759389889003532/793824080867753994/unknown.png
13:11:57*lum joined #nim
13:12:40*lum quit (Client Quit)
13:16:02*lum joined #nim
13:16:17Zevvmratsim: I bet that'll be a hell of a productive month for you then
13:19:24narimiranhey Zevv! is it know that npeg doesn't play nice with `result` when used in a function?
13:19:39narimiran*known
13:41:00Zevvnarimiran: hm like how
13:41:01Zevv \9
13:41:34FromDiscord<William_CTO> Morning.
13:41:35FromDiscord<William_CTO> (edit) "Morning." => "Morning"
13:42:07narimiranZevv: let me try to find you a small example
13:43:36narimiranZevv: `rule <- >+Digit * ": " * (letter | choice | list) * '\n': result[parseInt($1)] = foo`
13:44:22narimirani had do introduce a new variable, `bar`, do `bar[parseInt($1)] = foo`, and then `return bar`
13:47:39*habamax quit (Quit: leaving)
13:48:29*lritter joined #nim
13:52:07FromDiscord<himu> Hi. I am trying to run this example (second code example):↵https://nim-lang.github.io/Nim/intern.html#code-generation-for-closures-design↵Giving me errors.
13:53:00*def- quit (Quit: -)
13:53:34*Gustavo6046 joined #nim
13:54:40*def- joined #nim
13:56:18*rockcavera quit (Remote host closed the connection)
14:02:03*PMunch quit (Quit: leaving)
14:02:45FromDiscord<William_CTO> What errors @himu?
14:03:17FromDiscord<William_CTO> Also, I'd like to thank everyone for being so welcoming and gracious in this community!
14:07:20FromDiscord<himu> sent a code paste, see https://play.nim-lang.org/#ix=2KiJ
14:07:57*fanta1 joined #nim
14:08:11FromDiscord<CodeHz> I don't think it is runnable example..
14:08:23FromDiscord<CodeHz> it is pesudocode for demo
14:08:48FromDiscord<himu> code looks perfectly fine to me TBH
14:08:55FromDiscord<himu> Can I know what's wrong?
14:09:13FromDiscord<himu> (edit) "Can I know what's wrong? ... " added "and what should I do when I encounter such a case later"
14:09:52FromDiscord<CodeHz> tuple[...] need named field
14:10:08FromDiscord<CodeHz> aka `(prc: anan, data: env)`
14:10:19FromDiscord<CodeHz> (edit) "anan," => "anon,"
14:11:52FromDiscord<CodeHz> https://play.nim-lang.org/#ix=2KiO
14:12:00FromDiscord<CodeHz> and it is working version
14:12:34*superbia quit (Quit: WeeChat 3.0)
14:12:43FromDiscord<CodeHz> hmmm wait, why the `if` is needed
14:13:31FromDiscord<Rika> it is not
14:13:54FromDiscord<CodeHz> so
14:13:59FromDiscord<CodeHz> sent a code paste, see https://play.nim-lang.org/#ix=2KiP
14:14:56FromDiscord<CodeHz> (edit) "https://play.nim-lang.org/#ix=2KiP" => "https://play.nim-lang.org/#ix=2KiQ"
14:15:33FromDiscord<CodeHz> (edit) "https://play.nim-lang.org/#ix=2KiQ" => "https://paste.rs/kRq"
14:16:02FromDiscord<CodeHz> (edit) sent a code paste, see https://play.nim-lang.org/#ix=2KiS
14:16:54FromDiscord<himu> yeah. `if` is optonal. nevermind. what's `nimcall`. How many of these are there? What's the term for this BTW
14:17:13FromDiscord<himu> nimcall makes the difference it seems.
14:17:16FromDiscord<CodeHz> https://nim-lang.org/docs/manual.html#types-procedural-type
14:17:59FromDiscord<CodeHz> https://media.discordapp.net/attachments/371759389889003532/793845341069508608/unknown.png
14:17:59FromDiscord<himu> huh. great. thanks @CodeHz
14:18:57FromDiscord<William_CTO> How can I let a proc accept two different types of object as parameter?
14:19:12FromDiscord<William_CTO> I don't need to do an overload since the code is exactly the same
14:19:28FromDiscord<Rika> a: type1 or type2
14:19:44FromDiscord<Rika> effectively the same as overloading with the same body
14:19:45FromDiscord<haxscramper> Or `T1 | T2`
14:19:49FromDiscord<William_CTO> sent a code paste, see https://play.nim-lang.org/#ix=2KiT
14:19:54FromDiscord<Rika> yes
14:20:02FromDiscord<William_CTO> That can be `p: ProfanityAction | ProfanityMarker
14:20:04FromDiscord<William_CTO> (edit) "ProfanityMarker" => "ProfanityMarker`"
14:20:06FromDiscord<Rika> yes
14:20:08FromDiscord<William_CTO> Awesome thanks!
14:20:13FromDiscord<Rika> you can also use `or`
14:20:14FromDiscord<Rika> if you wna
14:20:15FromDiscord<Rika> want
14:20:33FromDiscord<William_CTO> Gotcha
14:21:30FromDiscord<himu> these are called union types right?
14:21:31FromDiscord<William_CTO> Which is used more often/more correct as an argument?↵`category: string = ""` or `category: Option[string] = none(string)`
14:23:50FromDiscord<CodeHz> it depends
14:24:49FromDiscord<haxscramper> `T1 | T2` is a user-defined type class https://nim-lang.org/docs/manual.html#generics-type-classes
14:26:20FromDiscord<haxscramper> I would recommend going with `Option[]` since `category.isSome()` is more idiomatic wrt. to your intentions
14:26:31FromDiscord<haxscramper> E.g. if something is optional, make it an `Option`
14:27:03FromDiscord<William_CTO> 👍
14:27:41FromDiscord<William_CTO> and in the proc I have to include `= none(T)` to make it an optional arg, correct?
14:27:43FromDiscord<himu> i missed a lot of things from the 3 part nim tutorial it seems. lol. interesting that i learnt this. i use this a lot in typescript. thanks!
14:27:50FromDiscord<CodeHz> btw nim don't have space-optimization like rust does(
14:28:13FromDiscord<haxscramper> You mean `--opt:size` for compilation?
14:28:23FromDiscord<CodeHz> so Option[something] will use more memory than plain string
14:28:28FromDiscord<CodeHz> (edit) "Option[something]" => "Option[string]"
14:29:07FromDiscord<haxscramper> SIze is `sizeof(bool)` more compared to regular string - https://github.com/nim-lang/Nim/blob/version-1-4/lib/pure/options.nim#L69
14:29:29FromDiscord<Starlk> Nim is statically typed, right?
14:29:34FromDiscord<haxscramper> Or rust has absolutely no overhead?
14:29:38FromDiscord<CodeHz> (but since struct must be aligned
14:29:49FromDiscord<CodeHz> so if string contains a pointer
14:30:06FromDiscord<CodeHz> the Option will use 8 byte overhead in 64bit system
14:30:11FromDiscord<CodeHz> (edit) "use" => "have"
14:30:29FromDiscord<CodeHz> (edit) "so if string contains a pointer ... " added "(and it must have)"
14:31:24FromDiscord<Rika> option string will not use more space afaik
14:31:44FromDiscord<Rika> i dont see why it would
14:31:54FromDiscord<haxscramper> There is no overhead `when T is SomePointer`, but since string is a value type
14:32:06FromDiscord<CodeHz> https://play.nim-lang.org/#ix=2Kj4
14:32:08FromDiscord<InventorMatt> @Starlk yes, Nim is statically typed
14:32:11FromDiscord<Rika> is string not handled like a pointer by options?
14:32:13FromDiscord<Starlk> Thank you
14:32:16*saem joined #nim
14:32:17FromDiscord<himu> BTW how big is this language. Nim. from the three part tutorial it seemed very straightforward. Nim has a lot and lot of features baked in.
14:32:24FromDiscord<Rika> its pretty big
14:33:14FromDiscord<CodeHz> yes, that's why I say it has 8 byte overhead(
14:33:20FromDiscord<Rika> okay
14:34:01*abm joined #nim
14:34:49FromDiscord<haxscramper> Three-part tutorial + manual covers most of the features you would need to use + there is a `std/macros` which you should also read if you want to work with macros. That's about all, though there is a lot of smaller details
14:34:49FromDiscord<CodeHz> and I don't think it is possible to create a new overload for Option[string]
14:35:09FromDiscord<CodeHz> (if you enabled nilSeqs options
14:35:23FromDiscord<haxscramper> Like https://nim-lang.org/docs/manual_experimental.html and https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features
14:35:23FromDiscord<CodeHz> (edit) "(if" => "(even if"
14:35:41FromDiscord<CodeHz> (edit) "and I don't think it is possible to create a new overload for Option[string] ... " added "and make it smaller"
14:36:00FromDiscord<CodeHz> (edit) "smaller" => "smaller, unless choose a magic value for string("
14:37:53FromDiscord<CodeHz> macros is good, until you got some random compile-time segfault(
14:38:08FromDiscord<CodeHz> (edit) "macros is good, until you got some random compile-time segfault( ... " added "happens in CI, but not in your machine("
14:38:37*Q-Master quit (Ping timeout: 260 seconds)
14:41:22*spiderstew_ quit (Ping timeout: 246 seconds)
14:42:28FromDiscord<haxscramper> Though there are several other modules in stdlib that can really change the way you write things. The most prominent one is `std/sugar`, but there is more depending on who you ask
14:47:30ForumUpdaterBotNew thread by Lachu: Error durning compilation: object constructor needs an object type;, see https://forum.nim-lang.org/t/7308
14:51:18*spiderstew joined #nim
14:51:51*def- quit (Quit: -)
14:54:02*def- joined #nim
14:54:38FromDiscord<bark> does this happen often
14:54:48FromDiscord<Rika> not really
14:55:44*Q-Master joined #nim
14:56:58FromDiscord<CodeHz> About <1 %, but it will silent break some tests(
14:57:44FromDiscord<Rika> not enough that youd be better off using another language no>
14:57:48FromDiscord<Rika> ?
14:59:15FromDiscord<CodeHz> (edit) About <1 %, but it will silent break some tests(and just click re-run to fix it
14:59:47*def- quit (Quit: -)
14:59:57*def- joined #nim
15:02:41FromDiscord<Balen> sent a code paste, see https://play.nim-lang.org/#ix=2Kjn
15:02:52FromDiscord<Balen> sent a code paste, see https://play.nim-lang.org/#ix=2Kjo
15:03:45*waleee-cl joined #nim
15:07:27FromDiscord<notchris> morning @Rika
15:08:09Oddmongeri don't understand this statement:
15:08:17Oddmongerhello "hello":
15:08:31Oddmonger (and then , concatenation of two variables)
15:08:43FromDiscord<Rika> gm to you notchris
15:09:15Oddmongerit was « echo "hello": », btw
15:09:28Oddmongeri've read this in the macro section of the manual
15:09:53FromDiscord<Rika> everything after the : is passed as the last argument or so i believe?
15:10:16Oddmongeri must admit i don't understant anything in the macro section
15:10:41Oddmongerthe echo thing is in «code block as argument»
15:10:54Oddmongerseriously, you can write things like this ?! but why ?
15:11:03FromDiscord<Rika> can be useful
15:11:14FromDiscord<Rika> for templates as an example
15:11:37Oddmongerah, for parametrizing an echo ?
15:12:09Oddmongerseems a complicated way for calling echo (truc & machin)
15:12:19FromDiscord<Rika> for echo its weird
15:12:44FromDiscord<CodeHz> I think it primarily for macro and template
15:13:14FromDiscord<CodeHz> `template t(body: untyped)`
15:13:23FromDiscord<CodeHz> and pass a block as body
15:13:46FromDiscord<Balen> everything or is like one argument passed to the last argument?
15:14:03FromDiscord<Rika> i dont remember
15:14:07FromDiscord<CodeHz> Only last argument
15:14:08FromDiscord<Rika> read the manual it knows more than me
15:14:17FromDiscord<Balen> I'll try it real quick
15:15:05FromDiscord<CodeHz> And if you do need more block parameters, use `do:` (( see experiment manual
15:15:48Oddmongerwell, i think i read first and understand later
15:16:20FromDiscord<CodeHz> and it also works for normal function call syntax:↵f("hello"):
15:29:11FromDiscord<CodeHz> (edit) note it also works for normal function call syntax:↵f("hello"):
15:32:04Zevvnarimiran: yeah, what's "result" in this case then
15:32:12Zevvit's not *your* result
15:39:04narimiranZevv: here's the full code: https://github.com/narimiran/AdventOfCode2020/blob/master/nim/day19.nim
15:39:37narimirani couldn't do `result[0]` and `result[1]`, i had to use `rules` and `messages`
15:40:59Zevvyour code blocks run inside an implicit proc, whoese return type is a bool indicating if the match succeeded
15:44:26narimiranaha!
15:44:43narimiranthanks for the clarification, Zevv!
15:45:24ZevvI chose not to document that because the implemenation might change
15:45:37Zevvit used to be a code block, but putting it inside a proc has some nice pro's regarding to isolation
15:48:35*def- quit (Quit: -)
15:49:51*def- joined #nim
15:56:23Oddmongeri cannot understand why this file reading is blocking: https://play.nim-lang.org/#ix=2Kjy
16:04:47Oddmongerok recursive call (read_file == readFile , didn't remember this one)
16:23:22*rockcavera joined #nim
16:37:51disruptekthe lion is the king of the jungle.
16:43:52FromDiscord<lantos> sent a code paste, see https://paste.rs/dti
16:45:30FromDiscord<Vindaar> Just do `initTable[string, MyObj]` and assign the object itself (or do you really want to have a pointer? in that case use `pointer` as the value)
16:45:43mipriptr MyObj
16:45:53FromDiscord<Vindaar> yes, this ^
16:47:14FromGitter<eagledot> @Vindaar hey,you active on arraymancer channel?
16:47:28*NimBot joined #nim
16:47:35FromDiscord<Vindaar> normally I am, but in the last few days haven't looked in there, sorry
16:48:08FromGitter<eagledot> Can i send you a message there now?
16:49:23FromDiscord<Vindaar> Are you Anubhav on gitter?
16:49:28FromGitter<eagledot> Yes
16:50:08FromDiscord<lantos> trying to avoid copies, if I had two tables would mean if I update one the other wouldn't update
16:50:26FromDiscord<lantos> (edit) "would" => "wouldn't this"
16:51:43*leorize quit (Ping timeout: 240 seconds)
16:51:50FromDiscord<Vindaar> a safer way to do that would be to make your object a `ref object` and then the update should update both
16:53:10*leorize joined #nim
16:55:02FromDiscord<bark> yeah, if you want to update both copies, make the "name" field ref
16:55:38FromDiscord<bark> i also provided a maybe overcomplicated example in #offtopic
16:55:52*leorize quit (Remote host closed the connection)
16:56:02FromDiscord<bark> i really overcomplicated it though, I guess the whole MyObj is not even neccessary if you have two tables
16:59:12*leorize joined #nim
17:00:52jkenWhat is the write signature for a proc called newMatrix(size: int) that returns a Matrix[size: int
17:01:31jkenI assumed `proc newMatrix(size: int): Matrix[size] =` but no dice
17:02:02*saem quit (Quit: Connection closed for inactivity)
17:03:32FromDiscord<lantos> sent a code paste, see https://play.nim-lang.org/#ix=1Vp4
17:03:53FromDiscord<lantos> sent a code paste, see https://play.nim-lang.org/#ix=2Kkg
17:04:17FromDiscord<Rika> how the
17:04:18FromDiscord<Rika> ?
17:04:27FromDiscord<Rika> oh
17:04:28FromDiscord<Rika> misread
17:05:03FromDiscord<Rika> in this case you have to store MyObjRefs on the seq
17:05:08FromDiscord<Rika> not just MyObjs
17:06:06FromDiscord<lantos> so I'd not use the MyObj directly anymore
17:06:13FromDiscord<Anuke> Is it normal for nimPNG to allocate several megabytes of `string`s that persist even after the image is gone? Code, tested with --gc:arc https://play.nim-lang.org/#ix=2Kkh
17:06:33*saem joined #nim
17:06:53FromDiscord<Rika> that doesnt sound right
17:07:35FromDiscord<Anuke> in this case I'm loading a 12x12 image, which should take up a few KB at most
17:08:49FromDiscord<lantos> sent a code paste, see https://play.nim-lang.org/#ix=2Kki
17:10:30FromDiscord<Rika> careful that this is much slower than using regular object
17:10:43FromDiscord<Rika> maybe a magnitude or so slower
17:10:56FromDiscord<Rika> so if you care about that then yeah
17:11:28FromDiscord<Anuke> sent a long message, see http://ix.io/2Kkk
17:12:32FromDiscord<Clyybber> @Anuke Can you try with orc?
17:13:38FromDiscord<Anuke> with orc, I get ~`5.6`MB, which is the same as with --arc
17:14:09FromDiscord<Sorrow> Hello. I'd like to get some help with porting some of my Python code to Nim. Is it okay to ask here?
17:14:55mipriif you're only using MyObjRef, there's no need for MyObj. just define a `ref object` instead
17:15:54FromDiscord<lantos> yeah is gotta go fast 😎
17:16:47FromDiscord<Anuke> Some other observations:↵- when I load the 12x12 image 1000 times in a loop, the memory usage doesn't change; it stays at 5.6 ↵- when I load a 4096x4096 image in a loop, the memory usage unpredictably jumps at certain iterations
17:17:31FromDiscord<lantos> just trying to see if i can make a lightweight dataframe. I know vindaar has a df but I don't understand it and would like to help someway
17:17:47FromDiscord<Clyybber> @Anuke Hmm, seems like without gc:arc its taking up those 5mb even before loading the image
17:19:04FromDiscord<Clyybber> oh, and isn't it 0.5mb?
17:19:25FromDiscord<Clyybber> oh, nevermind, stupid me forgot the image file :P
17:19:35FromDiscord<Anuke> when I completely skip any nimPNG code, it is 0.5mb
17:19:51FromDiscord<Anuke> but only after I call `getTotalMem()`
17:20:51FromDiscord<Anuke> I briefly skimmed the nimPNG code and couldn't find any global variables that could lead to 5.6mb usage
17:21:09FromDiscord<Anuke> (correction: any global variables at all)
17:23:49ForumUpdaterBotNew thread by Treeform: DumpIncludes - See where your exe size comes from., see https://forum.nim-lang.org/t/7309
17:27:15FromDiscord<Clyybber> @Anuke Heh, you were using getTotalMem, what you want is getOccupiedMem
17:27:44FromDiscord<Clyybber> Nim's default allocator doesn't return free memory to the OS immediately so thats why you are getting those numbers
17:28:01FromGitter<HJarausch_gitlab> How to contact Timothee Cour? I have found a nasty bug in his otherwise brilliant *iterate* macro. I'd like to discuss the issue with him.
17:28:08FromDiscord<Anuke> Oh, I see, thanks
17:28:25FromDiscord<Clyybber> HJarausch_gitlab: Just @timotheecour :)
17:28:40FromDiscord<Clyybber> on gitter
17:28:57FromGitter<HJarausch_gitlab> Does this work even he isn't online?
17:29:20FromDiscord<Clyybber> I think so
17:29:37FromGitter<HJarausch_gitlab> And what about attachments?
17:32:28FromDiscord<Rika> i'm currently in the process of making a rand lib like V's, was anyone doing the same?
17:35:11FromDiscord<lantos> are there things that could be included in the nim.random std?
17:36:02FromDiscord<Rika> uh i dont think so
17:36:10FromDiscord<shadow.> do i check platform with hostOS or when defined()
17:36:12FromDiscord<shadow.> (edit) "defined()" => "defined()?"
17:36:29FromDiscord<Rika> once i release the code it can be inched towards that code quality sure
17:37:51FromDiscord<Clyybber> HJarausch_gitlab: Not sure if gitter has attachments
17:38:02FromDiscord<shadow.> or rather what's the difference between hostOS and defined(windows/unix/etc)
17:39:47*Jesin quit (Quit: Leaving)
17:43:03*Kaivo quit (Quit: WeeChat 2.9)
17:44:47FromDiscord<Vindaar> @Rika don't know anything about V's `rand` lib, but you're aware of https://github.com/unicredit/alea ?
17:45:25FromDiscord<shadow.> if im making a parsing error type what should i inherit from
17:46:32FromDiscord<Rika> nope
17:46:50FromDiscord<Rika> damn i was beat haha
17:47:04FromDiscord<shadow.> ripp
17:47:15FromDiscord<Rika> well its kinda different still, what im doing
17:47:46FromDiscord<bark> Exception?
17:47:56FromDiscord<Rika> ah no what im doing is totally different lol
17:48:04FromDiscord<Rika> im porting many kinds of rngs
17:48:23FromDiscord<Rika> so i guess the lib im doing will aid alea
17:48:34*cyraxjoe quit (Ping timeout: 265 seconds)
17:48:50FromDiscord<shadow.> well i was thinking like
17:48:54FromDiscord<bark> wait is that UniCredit S.p.A. that large bank?
17:48:56FromDiscord<shadow.> ValueError or something idk?
17:48:59FromDiscord<bark> they doing stuff in nim?
17:49:03FromDiscord<shadow.> ig CatchableError works
17:49:15FromDiscord<Rika> valueerror exists in nim tho
17:49:16FromDiscord<Rika> doesnt it
17:49:40FromDiscord<bark> apparently it is, that's so coo
17:49:43FromDiscord<bark> (edit) "coo" => "cool"
17:49:45FromDiscord<shadow.> yeah ofc
17:49:50FromDiscord<shadow.> i was just wondering if that fit
17:49:52FromDiscord<shadow.> for this situation
17:53:55*cyraxjoe joined #nim
17:55:12*Jesin joined #nim
17:55:24FromDiscord<Rika> is there a way to check if the system's bit width is 32 or so
17:57:04FromDiscord<bark> https://media.discordapp.net/attachments/371759389889003532/793900476277587988/unknown.png
17:57:18FromDiscord<bark> 🤔 but i guess you can have 32 bit os-es on 64 bit cpu's
17:58:19FromDiscord<bark> sizeof(int) seems a bit hacky as well
17:59:57FromDiscord<Rika> yeah :KannaKMS:
18:00:12FromDiscord<Rika> fuck it ill do sizeof int
18:00:30*abm quit (Quit: Leaving)
18:02:27disruptekmadlad
18:09:10Zevvbit with is messy, it's not so simply
18:09:22Zevvyour ints might me 32 and your pointers 64, or the other way around
18:10:37Zevvconsider sizeof(Pointer)
18:10:58FromDiscord<Rika> https://nim-lang.org/docs/system.html#int says here always size of pointer
18:12:28Zevvhttps://play.nim-lang.org/#ix=2KkC
18:12:31Zevvlucky you :)
18:13:55FromDiscord<Rika> 🙂
18:21:17FromDiscord<Sorrow> sent a code paste, see https://play.nim-lang.org/#ix=2KkF
18:21:39FromDiscord<Sorrow> (edit) "https://play.nim-lang.org/#ix=2KkF" => "https://play.nim-lang.org/#ix=2KkG"
18:22:07FromDiscord<Rika> i cant help right now but i think you can find the info in the docs for `io`
18:22:13FromDiscord<Rika> io module i mean
18:22:40FromDiscord<Sorrow> Took a look earlier. Didn't really help.
18:25:05FromDiscord<Sorrow> Rats. Searching for bytes looks likes it's gonna be a pain, too.
18:25:06miprihttps://play.nim-lang.org/#ix=2KkI
18:27:24FromDiscord<Sorrow> Thank you.
18:30:54*a_chou joined #nim
18:33:38*a_chou quit (Client Quit)
18:37:46FromDiscord<Sorrow> What about reading bytes at a specific offset / pos?
18:39:29miprisame thing, but read instead of write.
18:39:46FromDiscord<bark> sent a code paste, see https://play.nim-lang.org/#ix=2KkM
18:39:49FromDiscord<bark> it says there is nothing to borrow
18:40:33FromDiscord<bark> (even after the edit it still)
18:40:39FromDiscord<bark> (edit) "https://play.nim-lang.org/#ix=2KkM" => "https://play.nim-lang.org/#ix=2KkN"
18:41:55mipriwhat I'd do is forget about the {.borrow.} and do it manually.
18:43:02FromDiscord<bark> I suppose that works
18:43:15miprihttps://nim-lang.org/docs/io.html#readChar%2CFile , https://play.nim-lang.org/#ix=2KkO
18:52:52FromDiscord<Sorrow> Thanks again.
18:58:08FromDiscord<Sorrow> Is it okay to slap a toHex(2) at the end of the readChar?
18:58:31mipritry it.
19:03:07*Arrrrrrrr joined #nim
19:05:16*vsantana joined #nim
19:10:01ForumUpdaterBotNew thread by Alexeypetrushin: How to parse custom JSON serialization format?, see https://forum.nim-lang.org/t/7311
19:21:55FromDiscord<Sorrow> Works fine. Is there anything like Py's find() by any chance? Works with bytes.
19:22:18mipriprobably. what's Py's find() do?
19:23:05mipri!eval import strutils; echo "hello".find 'e' # something like this?
19:23:08NimBot1
19:23:17FromDiscord<Sorrow> Returns the offset of the bytes to find.
19:25:04FromDiscord<Sorrow> Have to say I'm liking the lang so far.
19:37:13*xet7_ joined #nim
19:38:36*xet7 quit (Ping timeout: 240 seconds)
19:38:47disruptekweird.
19:49:32*hnOsmium0001 joined #nim
19:50:23*superbia joined #nim
19:50:40*superbia quit (Client Quit)
19:50:46saemis it?
19:52:47FromDiscord<cybertim> hooray my first project is working now in nim, and the binary is only 500kb 🤣 the spring-java version that was deployed previously was 32MB (and you need the jvm ofcourse) and now i got it using async and threads, threads communicate through a single channel using ids and the json lib, works great
19:53:17FromDiscord<cybertim> only thing that could really need some improvement is the tooling, but i guess this will get better eventually
19:53:19saemCongrats
19:53:33PrestigeThat's awesome
19:55:41*lritter quit (Ping timeout: 265 seconds)
19:56:08ForumUpdaterBotNew thread by Jseb: Using readFile with javascript, see https://forum.nim-lang.org/t/7312
19:56:30saemI know how that story goes. :D
19:59:27FromDiscord<cybertim> thanks, this feels better, most stuff now is so microservice based that making such huge blobs of apps is a bit hard to maintain if you can't get into the 'guts' after trying so many alternatives, we will see how this service will keep up in prod 😛
20:06:14Prestigenot open source I'm guessing?
20:09:32FromDiscord<cybertim> it's not closed or anything but very specific, i will probably port some deno and java projects to nim as well next year that are more suited to be released on github etc
20:09:54FromDiscord<Meowz> Damn.. next year?! Oh wait..
20:15:32jkenWhats the cleanest way to write this list eval in nim? sum(2**v for v in range(8) if f_eval[v] > 0)
20:20:57FromDiscord<haxscramper> As inline expression you could probably use `toSeq(0 .. 8).filterIt(f_eval[it] > 0)` or something similar
20:21:30FromDiscord<haxscramper> Or with `std/sugar.collect` `for v in 0 .. 8: if f_eval[v] > 0: 2 v`
20:22:23disrupteksurely it makes more sense to do this with bitops.
20:22:36jkenoh probably
20:22:42*L[m] left #nim ("User left")
20:26:24*rockcavera quit (Remote host closed the connection)
20:27:40*Kaivo joined #nim
20:45:51*wowaname joined #nim
20:46:09*radgeRayden joined #nim
20:46:53radgeRaydendom96: hi, I was taking a look at nimble, I'm curious about how coupled to nim itself it is? I'm interested in using it for another language.
20:47:27radgeRaydenwould I need to make drastic source code changes, or is it generic enough that I only need to distribute it with another configuration?
20:48:36*wowaname is now known as opal
20:52:43*xet7_ is now known as xet7
20:57:09*fanta1 quit (Quit: fanta1)
21:05:48*xet7 quit (Quit: Leaving)
21:06:14*xet7 joined #nim
21:17:39*jjido joined #nim
21:18:37*Arrrrrrrr quit (Quit: Arrrrrrrr)
21:19:30Zevvdisruptek
21:19:33disruptekwut
21:19:40Zevvdo I need to spend time to make tzevv work again?
21:19:47disruptekprobably, yes.
21:19:58Zevvk
21:20:10disruptekor you can wait and i'll get to it after i fix taste.
21:20:10*narimiran quit (Ping timeout: 256 seconds)
21:20:18disruptekwhich comes after i fix nimph ci.
21:20:47ZevvI want to see my compiler messages on a compile error with testes
21:20:48Zevvhow do
21:20:55disruptek--define:release
21:21:05disruptekjust run testes; it does the right thing.
21:21:27Zevvi aint got no testes in my path
21:21:37disruptekfreshen your testes.
21:22:14*superbia joined #nim
21:22:17*superbia quit (Client Quit)
21:22:54Zevvah all my AST is ill formed
21:22:58Zevvhow did that happen
21:24:47ZevvI forgot *all* about this stuff.
21:24:49ZevvError: no generic parameters allowed for ref
21:24:52Zevvwhy tho?!
21:26:35disruptekprobably something clyybber did. the guy is nuts.
21:27:21Zevvalways the same
21:29:44Zevv_very_ broken
21:29:45Zevvmost if it
21:30:04disruptekneat, right?
21:31:27Zevvsomething exit_
21:32:31disruptekwhat?
21:32:40ZevvError: implementation of 'exit_369100425' expected
21:32:41Zevvall new to me
21:32:48ZevvI never looked further then 0.0.13
21:33:08disruptekthere never /was/ further than 0.0.13.
21:33:37Zevvso those 73 commits _after_ 0.0.13
21:35:08disruptekyes yes?
21:35:48disruptekthat's typed, clyybber's work-around, rm double returns, test fixes, etc.
21:38:47Zevvsure I know
21:38:49Zevvjust whining
21:39:12disruptekmore typing, less whining.
21:40:23ForumUpdaterBotNew thread by Alexeypetrushin: How to turn proc that uses immutable shared object into pure func?, see https://forum.nim-lang.org/t/7315
21:51:16*rockcavera joined #nim
21:54:25ForumUpdaterBotNew thread by Alexeypetrushin: Should`type` or `typedesc` be used?, see https://forum.nim-lang.org/t/7316
21:58:12*vsantana quit (Quit: vsantana)
22:01:04FromGitter<akavel> HI! How can I write macro for something like: `css{foo: bar}`? I see jsffi does this by overloading `{}`, is that the only way? can I limit this overload to only "css" prefix somehow?
22:04:03planetis[m]just make a css macro that parses `{foo: bar}` syntax, not sure if your example is possible though
22:04:41disruptekit's possible, but unlikely to be worthwhile.
22:06:30FromGitter<akavel> worthwile does not matter here :D hobby project so unworthwhile things are the most worthwhile if they increase my joy and fun :D
22:07:00FromGitter<akavel> and the more fun I'm having the further I might get with the project :)
22:08:18FromGitter<akavel> trying to do it with simple `macro css(x: untyped) = echo x.treeRepr` unfortunately fails on `css{foo: bar}` with: "Error: undeclared identifier: '{}'"
22:08:41disruptekwell, impl a macro for `{}`. it can take, i dunno, a typedesc for `css` and untyped for the args, so you can parse them yourself without quotes.
22:09:02disruptekstore it in the css.nim module and export it into the code wherein it's used.
22:09:42FromGitter<akavel> is there a way to make it not collide with other `{}` macros?
22:10:06disruptekwhy would it?
22:10:29FromDiscord<lqdev> overload resolution would take care of it
22:10:35disruptekyou could make a Css type and use that instead.
22:10:46FromDiscord<lqdev> if the first param is `type css` or whatever
22:10:49FromGitter<akavel> hmmmmmm Css type might be the thing
22:10:59disrupteki doubt it matters.
22:11:05FromGitter<akavel> ?
22:11:12disrupteki doubt a type is necessary.
22:11:27FromGitter<akavel> I mean jsffi uses typedesc: https://nim-lang.org/docs/jsffi.html#%7B%7D.m%2Ctypedesc%2Cvarargs%5Buntyped%5D
22:11:42FromGitter<akavel> so I would imagine there could be collision here, if I also used typedesc, no?
22:12:11disruptekyes.
22:13:13FromGitter<akavel> Thanks! I'll try with Css type, wonder if it'll work :P
22:13:15disruptekuse `type css = distinct void`.
22:13:26disruptekuse `type css* = distinct void`.
22:14:04disruptekby the time you read this, i will already have written it.
22:14:17disrupteki'm speaking to you from the future.
22:14:32disruptekit sucks here.
22:16:39FromGitter<akavel> I think I need e.g. `type Css* = distinct void` and then `var css*: Css` or something similar, no? though I'd guess void value might not compile, so maybe rather `type Css* = object` or something?
22:17:36disruptektry my version first. sigmatch should prefer it.
22:18:37FromGitter<akavel> but then how I define the macro? `{}(csstag: css, ...)`? or `{}(csstag: typedesc[css], ...)`?
22:23:56FromGitter<akavel> `typedesc[css]` seems to work, and get distinguished from the one in jsffi; cool, thanks disruptek!!! :) :) :)
22:24:10disrupteksure.
22:24:15FromGitter<akavel> and sorry for making you cry in a corner!
22:24:46disruptekmy balls haven't been the same since zedeus.
22:25:12FromGitter<akavel> ?
22:25:17disrupteklong story.
22:26:03FromGitter<akavel> sounds like one :)
22:26:15FromDiscord<7815> if you can't override `=` or make something explicitly uncopiable, you must trust the user not to, right?↵asking if there is some way to make something uncopiable...
22:27:24FromDiscord<haxscramper> https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-eqcopy-hook
22:27:35FromGitter<akavel> but you got me curious so I found this login on github and gonna look into nitter code :D
22:27:56disruptekyeah.
22:28:25FromDiscord<7815> sent a code paste, see https://paste.rs/kKl
22:29:19FromGitter<akavel> some specific files/types/...keywords you recommend to look for to get some brain damage? :)
22:30:04FromDiscord<haxscramper> trianlge of pain
22:30:07disruptekare we talking about ketamine in #nim again?
22:30:31FromGitter<akavel> is NIm a drug?
22:30:54FromDiscord<haxscramper> actually it was a "tetrahedron of pain"
22:31:07disruptekgenerics, macros, statics, concepts.
22:31:36FromGitter<akavel> lol
22:31:48FromDiscord<haxscramper> If you manage to combine all of them together you are guaranteed to move to the higher plane of existence immediately
22:32:00FromGitter<akavel> ahahahaha
22:32:15FromDiscord<7815> I'm sorry, but how do i specialize `=copy` for i.e. `Foo`?
22:32:26FromDiscord<7815> (edit) "I'm sorry," => "I apologize,"
22:33:03FromDiscord<7815> (edit) "I apologize, but how do i specialize `=copy` ... for" added "i.e." | removed "i.e."
22:34:19FromDiscord<haxscramper> https://play.nim-lang.org/#ix=2Km1
22:34:40FromDiscord<haxscramper> If you remove echo it will trigger `=move` instead of copy, so no compilation error
22:35:22FromDiscord<haxscramper> IIRC it works a little differently from let's say C++ when `operator=() = delete` will give you error regardless
22:36:19FromDiscord<7815> is it possible for generic types?
22:37:12FromDiscord<7815> https://play.nim-lang.org/#ix=2Km2
22:38:06FromDiscord<haxscramper> ``proc `=copy`[T](dest: var Foo[T]; source: Foo[T]) {.error: "Foo is not copyable".}``
22:38:21FromDiscord<juliuskiesian> how do you specify type boundaries in nim generics? for example, i want to express something like this:
22:38:30FromDiscord<juliuskiesian> sent a code paste, see https://play.nim-lang.org/#ix=2Km6
22:39:16disruptekwhat's the point?
22:39:32FromDiscord<7815> I apologize, it's trivial, don't know why i seemed to have problems.
22:39:35FromDiscord<haxscramper> This is a valid code actually
22:40:01FromDiscord<haxscramper> E.g. I'm not quite following what you want to do exactly
22:40:42disrupteki think they mean to s/T: Node/T/ but i dunno.
22:42:33FromDiscord<juliuskiesian> so i have inputs and outputs of seq[T: Node] here.
22:42:49FromDiscord<juliuskiesian> there problem is how can i instantiate a Node then?
22:43:04disruptekNode()
22:43:11FromDiscord<haxscramper> Just `let node: Node[int]` or `Node[int]()`
22:43:23disruptekno, because T can only ever be a Node.
22:43:37disruptekno point to making it generic.
22:43:42FromDiscord<haxscramper> Alright, then `type Node = int | float`
22:43:49FromDiscord<juliuskiesian> T could be Add, Subtract, Multiply, Sigmoid etc.
22:44:06disruptekyou just defined it as a Node, only.
22:44:14FromDiscord<haxscramper> oh
22:45:27disruptekin the fragment `T: Foo`, `T` is an alias for the typeclass `Foo`.
22:45:29FromDiscord<haxscramper> @juliuskiesian You can do `T: Add | Subtract | Multiply | Sigmoid` to constrain generic parameters
22:45:35FromDiscord<juliuskiesian> i could. but then every time i set the values of inputs or outputs, i need to do something like `cast[Node](adder)`
22:45:48disrupteknope.
22:46:28FromDiscord<juliuskiesian> sent a code paste, see https://paste.rs/1Sy
22:46:58FromDiscord<juliuskiesian> that would be quite tedious as the node subtypes grow.
22:47:21disruptektype Node[T: Operations] .... seq[T] .... type Operations = Add or Subtract or Multiple or ...
22:47:31disruptekdon't use cast.
22:47:34disruptekdo read this:
22:47:36disruptek~disrupstyle
22:47:37disbotdisrupstyle: 11tips for writing code that won't provoke 😠 rants 🤬 on irc: https://gist.github.com/disruptek/6d0cd6774d05adaa894db4deb646fc1d -- disruptek
22:48:09disruptekthen var x = new Node[Add]() ... x.inputs = someAdds
22:48:22FromDiscord<juliuskiesian> and what if someone else writes a new node subtype? those won't work unless i change my code to include their types like `type Operations = Add or Subtract or Multiple or NewNode`
22:48:37disruptekthen don't define a typeclass.
22:48:45disruptektype Node[T] ... inputs: seq[T]
22:49:37disruptekyou could also use concepts, but, y'know, they are broken.
22:49:53saemnim dump -d:query_profiles foo.nims
22:49:53saem[... cut regular cfgs ...]
22:49:53saemHint: used config file '.../vscode-nim/foo.nim.cfg' [Conf]
22:49:53saemHint: used config file '.../vscode-nim/config.nims' [Conf] <-- is this correct, module kind beats module name match?
22:49:53saemHint: used config file '.../vscode-nim/foo.nims' [Conf]
22:50:22disruptekapparently.
22:50:27disrupteknims is for chumps.
22:50:33saemit's surprising, which is why I ask.
22:51:35saemI'd much rather .cfg and conventions around a few build profile parameters, but I'm weird.
22:52:00disrupteki agree, but timmy is a squeaky wheel.
22:52:35saem(in his best cartman voice): god damnit timmy
22:52:49disruptekit sucks.
22:52:58saemI tried.
22:53:09disruptekA for effort.
22:53:48saemImma cherish it forever
22:56:56*Vladar quit (Quit: Leaving)
23:07:28FromDiscord<Clyybber> Zevv: Heh, this time I don't think I fucked it up :p
23:08:54*vicfred joined #nim
23:09:12FromDiscord<Clyybber> saem: You think foo.nims should be processed before config.nims?
23:10:33saemClyybber: maybe... it's a surprise, but I can't say whether the kind match or the module match should win. I haven't really thought through the implications, like what do people typically mean if they have all those files.
23:11:03FromDiscord<Clyybber> It goes from least specific to most specific conceptually
23:11:07disrupteki would prefer that filename trumps directory name; this seems the most obvious.
23:11:18FromDiscord<Clyybber> Yeah, but thats how it is currently, no?
23:11:22disruptekno.
23:11:31saemOK, so that's package name, then right?
23:11:40saemSo kind, package, and module.
23:11:42disrupteki'd rather have foo.nim.cfg last.
23:11:53FromDiscord<Filipe Duarte> Hi, how do I pass a procedure as params of another procedure.
23:11:58FromDiscord<Clyybber> saem: What do you mean by "kind" ?
23:12:00FromDiscord<Filipe Duarte> (edit) "procedure." => "procedure?"
23:12:18disruptekproc foo(bar = proc(): int) = ...
23:12:34disruptekie. use anonymous proc syntax.
23:12:38saemClyybber: config.nims <-- the kind, nimscript. foo.nim.cfg <-- module name, but kind nim cfg
23:12:46FromDiscord<Clyybber> disruptek: but foo.nim.cfg is last in saems example?
23:12:53FromDiscord<Filipe Duarte> thnk
23:13:12disruptekin that case, it's right and config.nims is wrong.
23:13:29FromDiscord<Clyybber> Why would config.nims be wrong?
23:13:47disruptekbecause it's either ahead-of or behind a file-specific config.
23:13:51saemBecause the kind match makes it more specific, but the module name match, should trump that.
23:14:30FromDiscord<Clyybber> but it does? config.nims gets processed, then foo.nims then foo.nim.cfg ?
23:14:37FromDiscord<Clyybber> What order do you expect?
23:14:44disruptekthat sounds good to me.
23:15:19disruptekthe output doesn't make this clear, though, does it?
23:15:51FromDiscord<Clyybber> Hint: used config file '.../vscode-nim/config.nims' [Conf]↵Hint: used config file '.../vscode-nim/foo.nims' [Conf]↵Hint: used config file '.../vscode-nim/foo.nim.cfg' [Conf]
23:15:55FromDiscord<Clyybber> seems clear?
23:16:15disruptekthat's not the order that saem reported.
23:16:32FromDiscord<Clyybber> Huh, I guess the bridge reordered the messages then
23:16:38saemYeah, it did
23:16:49disruptekaha!
23:16:56FromDiscord<Clyybber> haha, I was so confused
23:17:40FromDiscord<Clyybber> saem: Can you open an issue?
23:17:41*radgeRayden quit (Ping timeout: 268 seconds)
23:17:43*radgeRayden_ joined #nim
23:18:16saemThis is the order from earliest line to latest line: 'vscode-nim/foo.nim.cfg', 'vscode-nim/config.nims', '/vscode-nim/foo.nims'
23:18:36saemClyybber, sure in a bit. I gotta get ready for an appointment.
23:18:54FromDiscord<Clyybber> thanks!
23:19:00saemnp
23:19:10disruptekiirc, the order /is/ a little subtle and the code actually collects the configs and reorders them or something before running them. or it runs them backwards. or upside-down. or some crazy shit.
23:19:34FromDiscord<ElegantBeef> Just throw a dart at the board to find the setting
23:22:08disrupteknimph's running of nimscript provokes a gc:orc bug, so... yeah, it's fun.
23:23:30saemI was asking about it because I'm writing the auto-detect projects for the vscode extension and was about to make every nimscript file a project.. .then realized someone (not naming names) wrote a whole project where people will crap out nimscript everywhere.
23:23:55FromDiscord<ElegantBeef> Hey i'm right here
23:24:00saemI said someone!
23:24:06saem:D
23:24:12FromDiscord<ElegantBeef> That someone is probably me 😛
23:24:18saemIt's definitely you
23:24:23FromDiscord<ElegantBeef> i mean the nimscript has to match a `.nim` file
23:24:31FromDiscord<ElegantBeef> Whereas mine it doesnt
23:24:46FromDiscord<ElegantBeef> you can name it dinglebopofthestarwarsep3thestartrek.nims
23:26:10disrupteki hope you have that backwards.
23:26:30FromDiscord<ElegantBeef> What do you mean?
23:26:33saemYeah, so I think I'm going to use effectively the same heuristic that I will for .nim files for nimscript files.
23:26:52disrupteki mean `smin.kertratseht3pesrawratsehtfopobelgnid`.
23:26:57FromDiscord<ElegantBeef> Ah
23:27:00FromDiscord<ElegantBeef> Yea same shit
23:27:16saemsmin is the code name for nim v3.0
23:27:28FromDiscord<ElegantBeef> Ah i misunderstood what you were looking for saem, thought you were still looking at config formats including nimscript
23:28:07FromDiscord<ElegantBeef> Honestly cause of how you dont see the API exposed to you in my version editor tools tend to be pretty bad
23:28:55saemOh... that too. It's all related, I spent like ~6 hours writing as much as I could on all the issues I'm seeing so I could get at the kernel of whatever I'm trying to solve. It was a lot to end up where I did.
23:31:33saemWhy don't you get to see the API exposed? <-- this question might be a mistake
23:34:17FromDiscord<ElegantBeef> Well cause i store it in the programs memory so you can use it for N number of scripts(only have a single main module support atm)
23:35:08FromDiscord<ElegantBeef> So you can load a bunch of interpreters but they all have the same API, atleast atm
23:36:10FromDiscord<ElegantBeef> I could always have an api that exports the API, but that kinda is risky if you load it cause users could change it
23:36:50disruptekyou think an api for your api is risky?
23:37:00disruptekjust put another api on it.
23:37:09FromDiscord<ElegantBeef> Well i meant a proc, but yea
23:37:41FromDiscord<ElegantBeef> Having the nimscript glue being visible in the file that the users can edit just seems like very likely for someone to fuck it up
23:42:57FromDiscord<iWonderAboutTuatara> odd error
23:43:01FromDiscord<iWonderAboutTuatara> I'm using raylib with nim
23:43:02FromDiscord<ElegantBeef> Odd user
23:43:09FromDiscord<iWonderAboutTuatara> lmao true
23:43:23FromDiscord<iWonderAboutTuatara> `SetShaderValue voroshader, ures, addr res, UNIFORM_VEC2` gives error expression ahs no address
23:43:37FromDiscord<iWonderAboutTuatara> res is a immurable variable
23:43:39FromDiscord<iWonderAboutTuatara> unsafeaddr works
23:43:43FromDiscord<ElegantBeef> well yea
23:43:53FromDiscord<ElegantBeef> addr doesnt work on immutables
23:43:59FromDiscord<ElegantBeef> hence the "unsafe" part
23:44:04FromDiscord<iWonderAboutTuatara> oh I see
23:44:05FromDiscord<iWonderAboutTuatara> thanks
23:44:34FromDiscord<ElegantBeef> https://nim-lang.org/docs/system.html#unsafeAddr%2CT
23:55:25*Prestige quit (Quit: Prestige)
23:59:43*Prestige joined #nim