<< 02-11-2022 >>

00:01:58*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
00:17:14*wallabra quit (Ping timeout: 246 seconds)
00:19:24*wallabra joined #nim
00:22:31*wallabra quit (Max SendQ exceeded)
00:25:55*wallabra joined #nim
00:40:16FromDiscord<proton> How to solve `/mnt/c/Users/low/.nimble/pkgs/stew-0.1.0/stew/results.nim(500, 6) Error: 'mapErr' can have side effects`
00:42:46FromDiscord<auxym> looks like an issue in the stew package. open an issue maybe? looks like it's actively maintained by status https://github.com/status-im/nim-stew
00:43:19FromDiscord<huantian> are you using this function yourself?
00:43:23FromDiscord<huantian> or is another package calling it
00:43:43FromDiscord<huantian> it looks like that func is using a devel feature?
00:44:36FromDiscord<huantian> (edit) "it looks like that func is using a devel feature? ... " added "is effects of devel only acutally?"
00:56:58FromDiscord<Elegantbeef> strict effects are default in Devel and it causes a lot of problems
00:57:40FromDiscord<proton> It was called by nimble install in nimbus-eth1.
00:58:11FromDiscord<proton> ok, I'll try v1.6.8
01:03:14FromDiscord<proton> How about `/mnt/c/Users/low/nimbus-eth1/nimbus/chain_config.nim(170, 30) Error: undeclared identifier: 'tkNumeric'` in v1.6.8
01:15:00FromDiscord<ringabout> In reply to @Elegantbeef "strict effects are default": For backwards compatibility, there is a switch `--legacy:laxEffects` to work around these issues.
01:39:41NimEventerNew Nimble package! asyncrabbitmq - Pure Nim asyncronous driver for RabbitMQ, see https://github.com/Q-Master/rabbitmq.nim
02:23:50*arkurious quit (Quit: Leaving)
02:29:02*wallabra_ joined #nim
02:29:45*wallabra quit (Read error: Connection reset by peer)
02:31:09*wallabra_ is now known as wallabra
04:17:42FromDiscord<tangonov> In reply to @Arathanis "You found one of": Lucky me! I will string format the anomalous kazillionth off the number later. I guess it doesn't matter if you're dealing with "whole" amounts like multiples of ten.
04:17:50FromDiscord<tangonov> Thanks @Arathanis
04:32:06*wallabra_ joined #nim
04:32:32*wallabra quit (Read error: Connection reset by peer)
04:34:21*wallabra_ is now known as wallabra
06:35:12*wallabra_ joined #nim
06:35:52*wallabra quit (Ping timeout: 252 seconds)
06:37:18*wallabra_ is now known as wallabra
07:28:28*PMunch joined #nim
07:31:32*kenran joined #nim
08:01:30*koltrast quit (Quit: ZNC - http://znc.in)
08:21:41FromDiscord<winger> Hello everyone
08:23:08FromDiscord<winger> How to use multi-type parameters in the Nim?
08:24:08FromDiscord<winger> sent a code paste, see https://paste.rs/p6j
08:24:16FromDiscord<winger> `Error: type mismatch: got 'seq[seq[string]]' for '@[domains]' but expected 'seq[string]'`
08:24:47*wallabra quit (Ping timeout: 246 seconds)
08:29:21FromDiscord<planetis> you can't do it at runtime with an if statement. If you need it at runtime use the json module. Else use overloads or a when statement
08:35:23FromDiscord<Elegantbeef> Or an object variant
08:37:31NimEventerNew thread by sls1005: To sink or not to sink, see https://forum.nim-lang.org/t/9569
08:38:25*jjido joined #nim
08:43:04FromDiscord<planetis> and it's typeof(domains) == string
08:43:20FromDiscord<Elegantbeef> No it's not
08:59:12*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
09:26:33FromDiscord<Phil> Overloads feel like the correct way to do this one IMO
09:27:50FromDiscord<planetis> that code doesn;t even parse for some reason
09:29:09FromDiscord<Rika> it is missing `proc`
09:50:07PMunchHmm, found a scenario where refc is about twice as fast as ARC..
09:50:35PMunchParsing through a massive stream of protobuf data and sending all the chunks via channels to be parsed in threads
10:27:52*koltrast joined #nim
10:38:05FromDiscord<planetis> PMunch: I would first make sure it doesn't leak because it's faster for Nims allocator to reuse freed memory than get new. Then that sending to channels doesn't make a fresh copy.
10:38:41FromDiscord<planetis> What channels do you use btw?
10:45:42FromDiscord<planetis> Or you could have freed data earlier and you just have to play with scopes or GC_fullCollect
10:47:59NimEventerNew thread by pietroppeter: How to edit the wiki?, see https://forum.nim-lang.org/t/9571
10:51:48*Ekho quit (Read error: Software caused connection abort)
11:04:24FromDiscord<luteva> Hi! What exactly does the "some" mean in:↵alice = newCustomer(some "Alice", userFoo)↵in the norm tutorial at: https://norm.nim.town/tutorial/rows.html
11:05:07FromDiscord<luteva> will it be added to a sequence? And if yes, why not work directly with a sequence?
11:06:07*Ekho joined #nim
11:07:29FromDiscord<ChocolettePalette> It might be a thing from std/options
11:07:29FromDiscord<ChocolettePalette> BUT I am noob at nim so I can't be sure
11:10:30FromDiscord<Rika> You’re right
11:10:55FromDiscord<luteva> thx!
11:21:12FromDiscord<luteva> sent a long message, see http://ix.io/4eKh
11:26:12*jmdaemon quit (Ping timeout: 255 seconds)
11:29:35FromDiscord<sOkam!> In reply to @luteva "Hi! What exactly does": Its the opposite of `none(Type)`, which will be an std/options variable containing `nil`↵`some(Type)` will instead contain a variable containing some value, hence the name
11:39:56PMunch@planetis, the standard library channels
11:40:40FromDiscord<nocturn9x> is it possible to turn off the GC in specific sections of the code at compile time?
11:41:07PMunch@nocturn9x, what do you mean?
11:41:20PMunchDo you want to disable the GC for your NimScript code?
11:41:24FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKn
11:41:30FromDiscord<nocturn9x> but Nim's garbage collector still fucks with mine
11:41:36FromDiscord<nocturn9x> In reply to @PMunch "Do you want to": not nimscript, nim
11:42:11FromDiscord<nocturn9x> I need specific sections of code to be compiled without garbage collection
11:42:20FromDiscord<nocturn9x> can I use pragmas?
11:42:40PMunchAgain I'm not certain what you mean
11:43:14PMunchYou can disable the GC like you showed, but for NimScript (the part of Nim which is executed by the compiler) I don't think it's possible
11:43:17PMunchI could be wrong though
11:43:27FromDiscord<nocturn9x> I don't need to disable it in nimscript
11:43:30FromDiscord<nocturn9x> but at runtime
11:43:39PMunchAh, then what you do works
11:43:42FromDiscord<nocturn9x> I do disable it that way, but somehow nim is still screwing my own memory manager
11:43:46FromDiscord<nocturn9x> In reply to @PMunch "Ah, then what you": except not
11:43:49FromDiscord<nocturn9x> it doesn't
11:43:51PMunchWhy do you have your own garbage collector?
11:44:04FromDiscord<nocturn9x> and I know it doesn't because if I compile with `--gc:none` it works
11:44:09FromDiscord<nocturn9x> In reply to @PMunch "Why do you have": because I have my own runtime
11:44:17FromDiscord<nocturn9x> this is the bytecode VM for my language
11:44:34FromDiscord<nocturn9x> the compiler needs the GC, but the VM doesn't
11:44:38FromDiscord<nocturn9x> and idk how to turn it off
11:44:45FromDiscord<nocturn9x> (edit) "and idk how to turn it off ... " added "other than what I did already"
11:45:02PMunchYou know how to turn it off, but that seems to not work (it probably does work, but something else is messing up)
11:45:13PMunchHow do you allocate memory in your VM?
11:45:22FromDiscord<nocturn9x> `alloc()`
11:45:38PMunchThat won't get touched by the GC whether it's on or not
11:45:46FromDiscord<Rika> you dont need to disable the GC if you're allocating raw pointers
11:45:54FromDiscord<nocturn9x> yeah I know
11:45:56FromDiscord<nocturn9x> in theory
11:46:02PMunchNo, not in theory
11:46:02FromDiscord<nocturn9x> in practice nim is doing something 🤷
11:46:07FromDiscord<nocturn9x> dude
11:46:13FromDiscord<nocturn9x> the docs say x
11:46:15PMunchI can guarantee you that the error is elsewhere
11:46:16FromDiscord<nocturn9x> my code says otherwise
11:46:23FromDiscord<Rika> i can attest to that
11:46:25FromDiscord<nocturn9x> I can guarantee you it's not
11:46:36FromDiscord<Rika> there is definitely something wrong with how you do things
11:46:55FromDiscord<nocturn9x> the issue goes away with `--gc:none`
11:46:58FromDiscord<nocturn9x> so, again, no
11:47:00PMunchIt might seem like the GC is doing something bad, while being something completely different. Memory stuff can be hard to reason about
11:47:17PMunchThat's not a guarantee that it's the GC's fault
11:47:27PMunchCould be a timing issue
11:47:34FromDiscord<nocturn9x> timing of what exactly?
11:47:42PMunchExecution
11:47:53FromDiscord<nocturn9x> care to elaborate?
11:47:57PMunchI haven't seen your code so it's a bit hard to reason about what might be wrong
11:48:20PMunchBut it is very unlikely that it's the GC
11:49:30FromDiscord<Rika> there could be some incorrect assumption you made with how nim handles memory?
11:49:32FromDiscord<Rika> idk really
11:49:47FromDiscord<nocturn9x> the issue also goes away if I compile with `-d:danger`
11:50:28FromDiscord<Rika> hard to tell exactly what it is
11:50:36PMunchI wouldn't be as optimistic as to say it "goes away", it's probably just hiding under some rock
11:50:52PMunchJust waiting to rear its head when you least expect it
11:51:03FromDiscord<nocturn9x> could it be cuz I'm mixing ref objects and pointers
11:51:43FromDiscord<nocturn9x> I'll try to switch to regular objects and use var parameters instead
11:52:11PMunchThat could definitely be causing some issues, yes
11:52:44PMunchIn fact I'd be surprised if it didn't..
11:53:53FromDiscord<Rika> mixing? as in casting? that would be disastrous yes
11:53:59FromDiscord<Rika> if you're just storing ptrs in refs thats fine
11:54:03FromDiscord<Rika> well maybe not
11:54:12FromDiscord<Rika> it would prolly at most cause leaks
11:54:25FromDiscord<Rika> and you know all the other manual mm issues you get
11:54:26FromDiscord<nocturn9x> I am storing ptrs in refs
11:54:33FromDiscord<nocturn9x> and casting said ptrs
11:54:35FromDiscord<Rika> what kind of bugs
11:54:37FromDiscord<nocturn9x> not the refs tho
11:54:37FromDiscord<Rika> oh
11:54:40FromDiscord<Rika> casting to what
11:54:40FromDiscord<nocturn9x> the ref is just an object variant
11:54:41FromDiscord<Rika> ptr T to what
11:54:48FromDiscord<nocturn9x> no it's like
11:54:50FromDiscord<nocturn9x> lemme show u
11:54:58FromDiscord<Rika> please do, thanks
11:55:13FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKo
11:55:20FromDiscord<nocturn9x> it's just a tagged union
11:55:53FromDiscord<Rika> and HeapObject.str is cast somehow?
11:56:24FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKp
11:56:26FromDiscord<nocturn9x> only casts occurr here
11:56:28FromDiscord<nocturn9x> (edit) "occurr" => "occur"
11:57:02FromDiscord<Rika> `sizeof(result)` for `ptr T` is always going to be byte size of pointer, not byte size of what you allocate
11:58:09FromDiscord<planetis> PMunch: that's deprecated and threading/channels is not good either. Try using the mratsim gist that's referred in the threading/channels doc
11:58:10FromDiscord<Rika> i think `sizeof(HeapObject)` is what you mean
11:58:56FromDiscord<nocturn9x> what
11:59:03FromDiscord<nocturn9x> oh
11:59:06FromDiscord<nocturn9x> yeah ig
11:59:21FromDiscord<Rika> that might have been related
11:59:51FromDiscord<Rika> maybe the `reallocate` proc you have is related as well?
12:01:47FromDiscord<nocturn9x> it could be
12:01:57FromDiscord<nocturn9x> I'm trying to see if I fixed it by using var types
12:02:19FromDiscord<nocturn9x> nope
12:02:28PMunch@planetis, hmm can't find the channels documentation any longer
12:02:33PMunchWhen was this deprecated?
12:03:48FromDiscord<auxym> @planetis this? https://github.com/nim-lang/threading
12:04:18FromDiscord<nocturn9x> this is my reallocate function
12:04:19FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKr
12:05:09FromDiscord<nocturn9x> btw I have a question
12:05:48FromDiscord<nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKs
12:05:59FromDiscord<nocturn9x> in this context, is `PeonVM.gc` mutable if `PeonVM` is passed as a var parameter?
12:08:01PMunchYes
12:08:15FromDiscord<planetis> Yeah it was removed
12:08:46PMunchJust removed and not replaced?
12:09:22FromDiscord<planetis> In devel I think it's on deprecated/ but can't look now
12:09:28PMunch@nocturn9x, not sure what current and total should be, but I'm not sure you've covered all the cases there
12:09:47FromDiscord<nocturn9x> In reply to @PMunch "Yes": good
12:09:51FromDiscord<nocturn9x> In reply to @PMunch "<@523555920265871380>, not sure what": wdym?
12:10:03FromDiscord<nocturn9x> current is the total amount of memory currently allocated
12:10:11FromDiscord<nocturn9x> total is the amount of memory allocated at all times
12:15:34*nyeaa49 joined #nim
12:15:37*nyeaa4 quit (Read error: Connection reset by peer)
12:15:40PMunchAh, so total always increases?
12:16:01FromDiscord<nocturn9x> yeah
12:16:49FromDiscord<nocturn9x> you thinking about overflows?
12:16:52FromDiscord<nocturn9x> Cuz I checked for that
12:19:01PMunchNah I was mostly just curious
12:20:28PMunch@planetis, switched to that channels implementation for my test, 2.732 on refc, 6.929 on ORC (refc still uses my old code)
12:21:32FromDiscord<planetis> Which one?
12:22:05PMunchThis one: https://github.com/nim-lang/threading
12:22:13FromDiscord<planetis> Lol no
12:22:23FromDiscord<planetis> It's not even threadsafe
12:22:44FromDiscord<planetis> There is a gist from mratsim
12:24:17PMunchWait what?
12:24:17FromDiscord<planetis> Try https://github.com/mratsim/weave/blob/5696d94e6358711e840f8c0b7c684fcc5cbd4472/unused/channels/channels_legacy.nim
12:24:47FromDiscord<planetis> For me even simple examples segfault
12:24:59FromDiscord<haxscramper> In reply to @planetis "There is a gist": Do you have a link? I couldn't find it on the mratsim's gists list on github
12:25:34FromDiscord<planetis> It was mentioned in the doc comment of threading channels posted above
12:25:49PMunchHmm, why is everything prefixed `channel_`..
12:26:42FromDiscord<haxscramper> In reply to @planetis "It was mentioned in": You mean this one https://github.com/mratsim/weave/pull/24?
12:26:45FromDiscord<haxscramper> (edit) "https://github.com/mratsim/weave/pull/24?" => "https://github.com/mratsim/weave/pull/24 ?"
12:28:44FromDiscord<nocturn9x> In reply to @PMunch "Nah I was mostly": kk
12:28:51FromDiscord<nocturn9x> idk then I'll have to figure this out somehow
12:28:54FromDiscord<nocturn9x> valgrind ig
12:28:56FromDiscord<nocturn9x> or asan
12:29:23FromDiscord<planetis> In reply to @haxscramper "You mean this one": That's a big PR I posted the link above
12:30:49PMunchHmm, I also have an annoying gcSafe error..
12:31:12PMunchBut Nim isn't being very specific as to why it's not gcsafe
12:45:21FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4eKw
12:47:58FromDiscord<jmgomez> Ok, it doesnt follow --path and it seems to accept relative paths
12:50:04FromDiscord<Rika> PATH is just the literal word, you want `$PATH`? even then idt nim accepts lists delimited by colon
12:50:40FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4eKx
12:51:00FromDiscord<jmgomez> I wanted to include an existing nim files on all the files
12:51:24FromDiscord<jmgomez> it seems to pick it by using a relative path to the entry point
12:55:06*def- quit (Read error: Software caused connection abort)
12:57:56*def- joined #nim
12:58:40*Ekho quit (Ping timeout: 252 seconds)
12:59:13*Ekho joined #nim
13:22:21*kenran quit (Remote host closed the connection)
13:31:22*derpydoo joined #nim
14:14:55*pyrex quit (Read error: Software caused connection abort)
14:15:48*pyrex joined #nim
14:24:22*lumidify quit (Read error: Software caused connection abort)
14:29:38*lumidify joined #nim
14:46:54FromDiscord<Require Support> not sure if someone has experience with this https://github.com/status-im/nim-chronos/blob/6525f4ce1d1a7eba146e5f1a53f6f105077ae686/chronos/handles.nim#L152 ↵↵noticed that chronos has a way to create "async" namedpipes on windows, anyone able to get a client/server example working? server starts async namedpipe, client connects to said namedpipe and they read/write from same pipe? is that even possible 🤔
15:03:04*LuxuryMode joined #nim
15:14:20*PMunch quit (Quit: Leaving)
16:15:43FromDiscord<ElementalX> Hi I have been trying Nimlang recently, just came around winim library, not pretty much versed with it but trying to use https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getversionexa in nim unlike in C++ how do I declare the struct OSVERSIONINFOEXA or incase it is declared how do I assign it a variable and then use the fields like `variable.dwOSVersionInfoSize` and print it? Any help will be appreciate
16:20:31FromDiscord<Require Support> In reply to @ElementalX "Hi I have been": not versed with it too but this might help https://github.com/khchen/winim/issues/57
16:20:44FromDiscord<ElementalX> thank you! checking it out!
16:28:18FromDiscord<lantos> sent a long message, see http://ix.io/4eLo
16:29:59FromDiscord<lantos> Also the seq initialisation seems to be slower :/
16:30:18FromDiscord<lantos> (edit) "Also the seq initialisation seems to be slower :/ ... " added "then I thought they would be"
16:33:10*lumidify quit (Ping timeout: 252 seconds)
16:34:45*lumidify joined #nim
16:36:10FromDiscord<prestosilver> I was today years old when i learned you can use a parameter of a function to define a default for another paramter https://media.discordapp.net/attachments/371759389889003532/1037404763689594890/2022-11-02-123307_410x74_scrot.png
16:36:21FromDiscord<prestosilver> kinda op
16:37:25FromDiscord<Rika> You can run blocks of code in a default parameter
16:37:39FromDiscord<Rika> As long as it returns a value
16:38:23FromDiscord<prestosilver> rly thats sick, i think the closest ive done is like a const or nil but never tried that lol
16:45:45FromDiscord<huantian> In reply to @lantos "Also the seq initialisation": I don't know how prime sieves work but would it be better to use a set instead of a seq?
16:49:22FromDiscord<huantian> actually I have no idea how thi sworks
16:50:37FromDiscord<lantos> set would add uniqueness and also a hash comp
16:51:49FromDiscord<huantian> yeah..
16:52:16FromDiscord<huantian> huh this nim code is interesting
16:52:17FromDiscord<huantian> maybe I'll try optimizing
16:53:31FromDiscord<lantos> i did a perf on it, its the $ being slow mainly
16:53:48FromDiscord<huantian> perhaps there's a better way to generate the output?
16:53:56FromDiscord<huantian> what format is it expected to be in
16:55:26FromDiscord<lantos> oh so the $ bottle neck isn't for formatting, theres a trick when you can use leading digits to catagorize nodes/tree into known paths so you don't have to traverse the whole thing
16:57:09FromDiscord<lantos> I'll probs look at a fast c++ int to str lib, but was wondering if someone here has a fast way to do it
16:57:56FromDiscord<huantian> hmmm I feel like the fast way to get leading digits would just be to use math and not str manips
16:59:08FromDiscord<huantian> but yeah someone might have a better int -> string converter
17:01:51FromDiscord<lantos> In reply to @Rika "You can run blocks": 😮
17:06:05FromDiscord<sdmcallister> sent a code paste, see https://play.nim-lang.org/#ix=4eLC
17:08:43FromDiscord<lantos> your code comment broke
17:10:53FromDiscord<lantos> how big is your csv?
17:11:15FromDiscord<sdmcallister> not very big, about 4000 rows. its all the api calls that take forever
17:11:24FromDiscord<lantos> youd want chunking and for something like this also threading to hand the processing off
17:11:31FromDiscord<lantos> read the whole csv first
17:11:55FromDiscord<lantos> (edit) "first" => "first, can the api call be called in parallel?"
17:13:03FromDiscord<sdmcallister> yeah, I believe so.
17:18:56FromDiscord<sdmcallister> running the script sync, due to api calls, takes 10 min (in Go).
17:20:48*derpydoo quit (Ping timeout: 255 seconds)
17:33:20FromDiscord<lantos> dang thats a long time for an api call
17:35:11FromDiscord<sdmcallister> Yeah, it is pretty bad. I think my approach kind of works but even then I'm still getting lots of failures from httpclient. I guess I can make some minor improvements but will be pretty limited by the service I'm calling.
17:40:17FromDiscord<huantian> An asynchronous semaphore might work
17:40:30FromDiscord<huantian> I tried copying one from python before, but there isn’t any in the Nim stdlib
17:44:57FromDiscord<lantos> httpfetch library should work fine
17:45:16FromDiscord<lantos> unless you need to process the chunked data
18:09:27*wallabra joined #nim
18:20:35NimEventerNew thread by blmvxer: Making a honey pot and errors with nmap, see https://forum.nim-lang.org/t/9572
18:25:06*arkurious joined #nim
18:29:40*koltrast quit (Ping timeout: 248 seconds)
18:30:59FromDiscord<ShalokShalom> In reply to @prestosilver "I was today years": Can you tell me, which theme/editor that is?
18:31:07FromDiscord<ShalokShalom> Looks neat with Nim.
18:31:56FromDiscord<prestosilver> vscode with the dracula theme and nim plugin
18:34:16FromDiscord<ShalokShalom> Thanks
18:34:33FromDiscord<ShalokShalom> The saem one?
18:35:02FromDiscord<ShalokShalom> Just asking, since it's the most fresh, and the other one is ranking higher on vscode search results.
18:35:21FromDiscord<huantian> yep saem one
18:36:10FromDiscord<prestosilver> actually im using the top one bc the other one lags vscode for me if i remember right
18:36:36FromDiscord<prestosilver> i normally use neovide but ive been testing out vscode for a bit
18:38:01*lumidify quit (Ping timeout: 252 seconds)
18:38:49*derpydoo joined #nim
18:39:57*lumidify joined #nim
18:43:02FromDiscord<ShalokShalom> There are actually a couple ones.
18:43:03*jjido joined #nim
18:43:17FromDiscord<ShalokShalom> Saem should not lag, maybe you got a third, different one?
18:46:24FromDiscord<prestosilver> yea idk ill check it out, i may have been using alt before
19:46:52FromDiscord<ezquerra> I'd be nice if there was an official VSCode plugin, published by the nim team
19:46:55FromDiscord<ezquerra> (edit) "I'd" => "It'd"
20:04:26*krux02_ joined #nim
20:25:10FromDiscord<ShalokShalom> Yeah, totally. But the main issue is, that the most frequently downloaded one is maintained by a person, who lost contact with the community
20:25:32FromDiscord<ShalokShalom> So we can't take it down, and everybody looking for 'Nim' plugins, will see it first
20:25:44FromDiscord<ShalokShalom> So they download it, and the cycle succeeds
20:26:14FromDiscord<ShalokShalom> Doing an official Nim plugin, would sadly not help 🤷🏻‍♂️
20:29:07*arkurious quit (Ping timeout: 252 seconds)
20:40:21*PMunch joined #nim
20:41:35*arkurious joined #nim
20:43:05*koltrast joined #nim
21:12:00FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMl
21:12:42FromDiscord<Elegantbeef> The lines iterator is actually quite slow iirc
21:14:42FromDiscord<ElegantBeef> Uh oh matrix bridge is dieded
21:14:52FromDiscord<ElegantBeef> https://play.nim-lang.org/#ix=4eMm is quicker than nim's builtin `lines`
21:15:10FromDiscord<ElegantBeef> But i assume it doesnt cover all the same thing as Nim's builtin lines
21:20:30FromDiscord<4zv4l> yeah the difference is quite huge
21:21:27FromDiscord<4zv4l> oh yeah I forgot about `iterators` hand made function
21:21:49FromDiscord<4zv4l> Nim is amazing damn↵or maybe I'm just too used to low level idk↵Nim brings so many things I've never seen before
21:21:56FromDiscord<Elegantbeef> Suffice to say it&#x27;s very hard to read the `readLine` function https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/io.nim#L376-L495
21:22:09FromDiscord<4zv4l> I was just wondering one thing
21:23:47FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMo
21:23:53FromDiscord<4zv4l> if it does (I can be wrong)
21:24:06FromDiscord<Elegantbeef> Cause Nim is safer
21:24:19FromDiscord<Elegantbeef> `s[a..b]` allocating means the slice can outlive `s`
21:24:38FromDiscord<Elegantbeef> If you want a 0 cost slice you do `s.toOpenArray(a, b)` and pass it to a function that takes `openarray[char]`
21:25:07FromDiscord<Elegantbeef> Nim doesnt have a borrow checker by default so `toOpenArray` can only be used to pass to procedures
21:25:34FromDiscord<Elegantbeef> sent a long message, see http://ix.io/4eMq
21:25:47FromDiscord<Elegantbeef> Well i guess i need to fix element cause cinny is causing a fucking headache to you guys
21:26:12FromDiscord<sOkam!> In reply to @4zv4l "Nim is amazing damn": you will be amazed at how much nicer low level stuff is with nim, even if it looks high level on the surface
21:26:37FromDiscord<4zv4l> or right, the element bridge 😆
21:26:50FromDiscord<4zv4l> In reply to @sOkam! "you will be amazed": yeah it's really nice indeed just
21:26:54FromDiscord<4zv4l> I guess that's slower
21:26:59FromDiscord<4zv4l> since for each slice it allocates memory
21:28:35*derpydoo quit (Quit: derpydoo)
21:29:09FromDiscord<4zv4l> idk if they could add a check like if the compiler sees that the slice is outliving the basic string then it allocates it↵otherwise it can just slice on the same string without allocation
21:32:07FromDiscord<Elegantbeef> I mean that's what a borrow checker is for
21:32:18FromDiscord<4zv4l> doesn't Nim kinda have one ?
21:32:29FromDiscord<Elegantbeef> It does have an experimental one
21:32:33FromDiscord<Elegantbeef> It doesnt have a stable usable one
21:33:16FromDiscord<4zv4l> yeah I got confused, I tried the `arc` gc and I thought that would add at compile time `alloc` and `free`↵but when I tried to check the code with gdb there would still be the `nimMain` or its like this anyway even without gc ?
21:33:38*derpydoo joined #nim
21:33:39FromDiscord<4zv4l> never used gdb on a gc language before, just in case, maybe that's why it confused me
21:33:49FromDiscord<Elegantbeef> nim main exists for a multitude of reasons
21:34:09FromDiscord<sOkam!> Is there anything in Nim similar to python's `pathlib`?
21:34:30FromDiscord<Elegantbeef> If you want to look at what nim does i highly suggest compiling with `--mm:arc -d:danger --nimcach:some/path/nearby/` then looking at the `@myourmodule.c`
21:34:47FromDiscord<Elegantbeef> I swear people really need to explain what modules are from X language when they ask
21:34:56FromDiscord<Elegantbeef> I now have to look up pathlib to see what the hell that is
21:35:17FromDiscord<Elegantbeef> Type safe paths
21:35:17FromDiscord<sOkam!> its just a path management lib, that uses Path type instead of strings
21:35:23FromDiscord<sOkam!> yeah, pretty much
21:35:31FromDiscord<Elegantbeef> https://nimble.directory/search?query=path
21:35:42FromDiscord<Elegantbeef> Nim2.0 will have typesafe paths 😄
21:36:53FromDiscord<4zv4l> Nim 2.0 ? will it be like Python and changes lot of things or will be a sweet update ?
21:37:23FromDiscord<Elegantbeef> It is mostly backwards compatible, there are some new changes like flags on by default which may require maintenance but it's mostly the same
21:37:26FromDiscord<Elegantbeef> I mean Araq wants it out this year
21:37:31*jmdaemon joined #nim
21:38:01FromDiscord<Elegantbeef> But yea typesafe path https://github.com/nim-lang/Nim/blob/devel/lib/std/paths.nim
21:39:59FromDiscord<4zv4l> In reply to @Elegantbeef "If you want to": yeah right I saw `nimMain` `nimMainModules` `nimMainInner`
21:40:14FromDiscord<4zv4l> and the actual code is in `NimMainModule` right ?
21:40:19FromDiscord<4zv4l> (edit) "`nimMainModules`" => "`nimMainModule`"
21:40:40FromDiscord<dlesnoff> Sorry in advance if it feels a bit offtopic
21:40:49FromDiscord<dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4eMt
21:41:19FromDiscord<dlesnoff> (edit) "https://play.nim-lang.org/#ix=4eMt" => "https://play.nim-lang.org/#ix=4eMu"
21:41:58FromDiscord<dlesnoff> I guess I should write this script in Nim directly if I seek help in this channel 😅
21:42:35FromDiscord<dlesnoff> (edit) "https://play.nim-lang.org/#ix=4eMu" => "https://play.nim-lang.org/#ix=4eMv"
21:46:40FromDiscord<dlesnoff> I guess I will handle it myself, by converting it into Nim
22:02:56FromDiscord<Elegantbeef> Yea it's very confusing why you wouldnt just make your own Nim file to do this
22:03:11FromDiscord<Elegantbeef> Something like that↵(@4zv4l)
22:06:34PMunchHmm, well this is annoying.. I wanted to extend a static object with some dynamic fields. So I created a new object and added a static[] generic parameter for the original object. But it appears that Nim sometimes doesn't understand this and generates a runtime object out of it..
22:12:41FromDiscord<Elegantbeef> uh huh
22:20:33FromDiscord<dlesnoff> In reply to @Elegantbeef "Yea it's very confusing": I wanted a zsh/bash script for execution speed mostly, and avoiding splitting the script from the testing directory.↵I realized also that I can not include three quotes """ in a multiline string in Nim
22:21:10PMunchHmm, I think it might be a cross
22:21:13PMunchOops
22:21:22PMunchI think it might be a cross-module issue
22:22:14FromDiscord<ezquerra> In reply to @ShalokShalom "Doing an official Nim": I think it would help. People would see who made the plug-in and some would then use it. If the other (Nimsaem and Nim Alt) plug-ins were deprecated that would help too
22:23:28FromDiscord<ezquerra> Also I wonder if there is some way to contact the VSCode plug-in team to make that official nim plug-in (once it existed) one of their “recommended” plugins
22:25:08PMunchI mean the issue is with code like this: http://ix.io/4eMB
22:25:29PMunchBut that code in particular behaves as you would expect, with Device never actually entering the code
22:27:10*krux02_ quit (Remote host closed the connection)
22:29:57FromDiscord<Elegantbeef> Were you perhaps using some code in such a way that'd require it at runtime?
22:30:02FromDiscord<Elegantbeef> This makes me think it'd be nice to be able to annotate `{.compileTime.}` on a type which errors if it gets to codegen
22:31:13FromDiscord<4zv4l> is it normal that the `test` in my source code are still being executed when compiling in `release` ?
22:31:54FromDiscord<Elegantbeef> 'the test'?
22:32:18FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMD
22:32:32FromDiscord<4zv4l> `Basic tests` is being run even when I compile this as `--d:release`
22:32:35FromDiscord<Elegantbeef> Well yea it should be getting ran you dont have any defines
22:32:59FromDiscord<4zv4l> I thought it would skip test in release mode
22:33:05PMunchNope, it allocates it, calls zeroMem on it, sets one field to an int literal, and then immediately call a procedure which accesses this freshly assigned int
22:33:09FromDiscord<Elegantbeef> Nope you might want to test code in release
22:33:27PMunchcompileTime on types would be great
22:33:42FromDiscord<4zv4l> how can I check like↵`when isNotRelease` ?
22:33:43FromDiscord<Elegantbeef> Seems like the const folding might be having a drink
22:33:54FromDiscord<Elegantbeef> `when not defined(release)`
22:33:58FromDiscord<Elegantbeef> or just make a test directory like a sane person
22:34:19FromDiscord<Elegantbeef> But then again you arent doing `import std/[strutils, strformat, unittest]` so i take back the sane comment
22:34:40FromDiscord<Elegantbeef> Well pmunch if you get a min repo i'll take a look
22:34:45FromDiscord<4zv4l> In reply to @Elegantbeef "or just make a": I'll probably do this yeah
22:34:55FromDiscord<4zv4l> In reply to @Elegantbeef "But then again you": wdym ?
22:35:25FromDiscord<4zv4l> there is a difference between how I import and how you wrote it ?
22:35:50*rockcavera joined #nim
22:35:50*rockcavera quit (Changing host)
22:35:51*rockcavera joined #nim
22:36:46FromDiscord<Elegantbeef> You're not prefixing `std` on the stdlib modules and have multiple lines for no reason
22:37:06FromDiscord<Elegantbeef> Yours can accidently import the wrong module
22:37:23FromDiscord<Elegantbeef> if you have a module with the same name next to this module it imports that over the stdlib
22:38:01FromDiscord<Elegantbeef> The convention is to prefix all stdlib modules with `std/` as all new ones will require it
22:38:50PMunchHmm, if I create a template which wraps the procedure I call which takes that int (the `readFrom` in my example) but specifies static[int] it works. The template only assigns it to a variable and passes it into the original version
22:39:12FromDiscord<4zv4l> In reply to @Elegantbeef "The convention is to": I'll take that habits, thanks !
22:39:15FromDiscord<4zv4l> (edit) "habits," => "habit,"
22:39:25PMunchSo it's almost like the `readFrom` procedure doesn't understand that the input can be static..
22:39:47FromDiscord<luteva> sent a long message, see http://ix.io/4eMG
22:39:59FromDiscord<sOkam!> In reply to @Elegantbeef "But yea typesafe path": tysm↵btw, beef. I saw you talk some days ago about ECS stuff, but I had no clue what that was. I just remember you talking about it↵But... now I'm reading about it, and I'm actually really curious on how to do this with Nim↵Would you recommend `polymorph` as an ecs library?
22:40:32FromDiscord<Elegantbeef> I dont really do ECS, but i'm sure @rlipsc would recommend it
22:41:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eMH
22:41:17FromDiscord<Elegantbeef> Recursive type defs need to be in the same type block
22:41:36FromDiscord<Elegantbeef> Well this isnt even recursive but anyway
22:41:47FromDiscord<Elegantbeef> Use single type defs to safe your sanity
22:44:47FromDiscord<Elegantbeef> Oh pmunch i might know the issue
22:45:03FromDiscord<Elegantbeef> a dot expression might be considered not simple
22:45:12PMunchHmm
22:46:03PMunchBut the object is `static[Device]`
22:46:11PMunchSo why does it create a runtime copy of it?
22:46:28FromDiscord<Elegantbeef> Like i said the code folding only considers simple statements
22:46:45FromDiscord<Elegantbeef> if you do `static(x.device.address)` it properly works as you noted
22:48:08PMunchIndeed
22:48:32FromDiscord<Elegantbeef> So this means the constant folding is failing to identify the simplicity
22:48:42FromDiscord<Elegantbeef> Which makes me think https://github.com/nim-lang/Nim/blob/devel/compiler/ccgexprs.nim#L1146 is the problem
22:50:08PMunchHmm, possibly
22:50:40FromDiscord<Elegantbeef> Actually that might not be used anymore
22:50:41PMunchI'll have to find a way to create a minimal sample to test it
22:50:59FromDiscord<Elegantbeef> I mean what you provided was good enough
22:51:12FromDiscord<luteva> sent a code paste, see https://play.nim-lang.org/#ix=4eMI
22:51:19PMunchOh wait
22:51:37PMunch@Elegantbeef, if you compile that sample with --gc:arc it shows the behaviour I was talking about
22:51:54FromDiscord<Elegantbeef> Yea that's what i always use for small examples 😛
22:52:12FromDiscord<Elegantbeef> Arc makes looking at the Nim code gen much easier
22:52:27FromDiscord<Elegantbeef> `--mm:arc -d:danger` is relatively readable
22:54:00FromDiscord<dlesnoff> I do not manage to write a new file
22:54:14FromDiscord<dlesnoff> (edit) "I do not manage to write a new file ... " added "in Nim."
22:54:21FromDiscord<Elegantbeef> `isSimpleExpr` is not used anymore
22:54:23FromDiscord<Elegantbeef> So shucks
22:55:00FromDiscord<dlesnoff> writeFile(filename, string) does not create a new file, I am so confused.
22:55:36FromDiscord<dlesnoff> Is this outdated https://nim-by-example.github.io/files/ ?
22:55:50FromDiscord<Elegantbeef> It certainly will
22:56:00*PMunch quit (Ping timeout: 252 seconds)
22:56:41FromDiscord<dlesnoff> Yes but I mean for 1.6.8 it should not be outdated right ?
22:57:06FromDiscord<dlesnoff> It says that writeFile creates a new File if filename doesn't exist
22:57:33FromDiscord<Elegantbeef> Which it does
22:59:06FromDiscord<luteva> so there seems to be some special notation for seq[Email] in norm. Anyone knows?
22:59:56FromDiscord<Elegantbeef> @Phil\: would know, but i assume they're presently asleep
23:01:03FromDiscord<luteva> ok thx! gonna ask again later, maybe he is back then....
23:03:22FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMP
23:04:39FromDiscord<Elegantbeef> `raise newException(ExceptionType, "This is a custom error")`
23:04:57FromDiscord<Elegantbeef> It's highly suggested to make your own exception to allow users to specify the error, unless a builtin one suffices
23:06:23FromDiscord<4zv4l> like making a Exception kinda enum available so when people import my lib they can see the exception that can happen ?
23:07:49FromDiscord<Elegantbeef> Nim has an effect system which allows you to say "Only x exception is allowed" so it allows users to specify what they want to happen
23:08:04FromDiscord<Elegantbeef> Ok Pmunch i think i see the issue, it loses it's staticness
23:08:21FromDiscord<Elegantbeef> It's transformed into `discard readFrom(Device(bus: Bus(), address: 100'u).address)`
23:08:37FromDiscord<pmunch> Exactly
23:09:04FromDiscord<Elegantbeef> Which means it's likely before codegen
23:09:43FromDiscord<pmunch> Damn it, I posted a bunch of messages. But apparently I had disconnected from IRC..
23:11:21FromDiscord<pmunch> I had even created code pastes with the outputs..
23:11:31FromDiscord<pmunch> And a version with the template
23:11:53FromDiscord<dlesnoff> In reply to @Jiezron "It says that writeFile": Sorry again I got it, writeFile only take the filename and not the file path
23:12:30FromDiscord<Elegantbeef> Yea i'm ripping the compiler apart so it's fine pmunch 😄
23:14:45FromDiscord<pmunch> sent a long message, see http://ix.io/4eMT
23:14:47FromDiscord<pmunch> That's the log from my IRC client
23:15:24FromDiscord<pmunch> In case it helps
23:16:11FromDiscord<Elegantbeef> It doesnt sadly, but alas
23:16:12FromDiscord<Elegantbeef> Buh bye
23:16:19FromDiscord<pmunch> Bye
23:16:59FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMU
23:18:16FromDiscord<Elegantbeef> No
23:18:21FromDiscord<Elegantbeef> `lines(fileName)` will
23:18:48FromDiscord<4zv4l> In reply to @Elegantbeef "`lines(fileName)` will": will it still be an iterator and not read the whole file once ?
23:19:28FromDiscord<Elegantbeef> It's an iterator
23:19:33FromDiscord<Elegantbeef> How do i say RTFM nicely? 😛
23:20:47FromDiscord<4zv4l> can always ask just in case xD
23:21:46FromDiscord<4zv4l> because technically↵> Iterates over any line in the file named filename↵doesn't mean it doesn't read the whole file and then for loop and yield line by line
23:23:55FromDiscord<pmunch> Hmm, I wonder if there is a better way to structure a static/dynamic type duo like that..
23:26:13FromDiscord<Elegantbeef> I mean this is fine pmunch there is just an issue with the sem checker
23:26:59FromDiscord<Elegantbeef> How would you close the file though 4zv4l
23:27:16*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)