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:16 | FromDiscord | <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:46 | FromDiscord | <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:19 | FromDiscord | <huantian> are you using this function yourself? |
00:43:23 | FromDiscord | <huantian> or is another package calling it |
00:43:43 | FromDiscord | <huantian> it looks like that func is using a devel feature? |
00:44:36 | FromDiscord | <huantian> (edit) "it looks like that func is using a devel feature? ... " added "is effects of devel only acutally?" |
00:56:58 | FromDiscord | <Elegantbeef> strict effects are default in Devel and it causes a lot of problems |
00:57:40 | FromDiscord | <proton> It was called by nimble install in nimbus-eth1. |
00:58:11 | FromDiscord | <proton> ok, I'll try v1.6.8 |
01:03:14 | FromDiscord | <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:00 | FromDiscord | <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:41 | NimEventer | New 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:42 | FromDiscord | <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:50 | FromDiscord | <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:41 | FromDiscord | <winger> Hello everyone |
08:23:08 | FromDiscord | <winger> How to use multi-type parameters in the Nim? |
08:24:08 | FromDiscord | <winger> sent a code paste, see https://paste.rs/p6j |
08:24:16 | FromDiscord | <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:21 | FromDiscord | <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:23 | FromDiscord | <Elegantbeef> Or an object variant |
08:37:31 | NimEventer | New 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:04 | FromDiscord | <planetis> and it's typeof(domains) == string |
08:43:20 | FromDiscord | <Elegantbeef> No it's not |
08:59:12 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |
09:26:33 | FromDiscord | <Phil> Overloads feel like the correct way to do this one IMO |
09:27:50 | FromDiscord | <planetis> that code doesn;t even parse for some reason |
09:29:09 | FromDiscord | <Rika> it is missing `proc` |
09:50:07 | PMunch | Hmm, found a scenario where refc is about twice as fast as ARC.. |
09:50:35 | PMunch | Parsing 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:05 | FromDiscord | <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:41 | FromDiscord | <planetis> What channels do you use btw? |
10:45:42 | FromDiscord | <planetis> Or you could have freed data earlier and you just have to play with scopes or GC_fullCollect |
10:47:59 | NimEventer | New 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:24 | FromDiscord | <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:07 | FromDiscord | <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:29 | FromDiscord | <ChocolettePalette> It might be a thing from std/options |
11:07:29 | FromDiscord | <ChocolettePalette> BUT I am noob at nim so I can't be sure |
11:10:30 | FromDiscord | <Rika> You’re right |
11:10:55 | FromDiscord | <luteva> thx! |
11:21:12 | FromDiscord | <luteva> sent a long message, see http://ix.io/4eKh |
11:26:12 | * | jmdaemon quit (Ping timeout: 255 seconds) |
11:29:35 | FromDiscord | <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:56 | PMunch | @planetis, the standard library channels |
11:40:40 | FromDiscord | <nocturn9x> is it possible to turn off the GC in specific sections of the code at compile time? |
11:41:07 | PMunch | @nocturn9x, what do you mean? |
11:41:20 | PMunch | Do you want to disable the GC for your NimScript code? |
11:41:24 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKn |
11:41:30 | FromDiscord | <nocturn9x> but Nim's garbage collector still fucks with mine |
11:41:36 | FromDiscord | <nocturn9x> In reply to @PMunch "Do you want to": not nimscript, nim |
11:42:11 | FromDiscord | <nocturn9x> I need specific sections of code to be compiled without garbage collection |
11:42:20 | FromDiscord | <nocturn9x> can I use pragmas? |
11:42:40 | PMunch | Again I'm not certain what you mean |
11:43:14 | PMunch | You 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:17 | PMunch | I could be wrong though |
11:43:27 | FromDiscord | <nocturn9x> I don't need to disable it in nimscript |
11:43:30 | FromDiscord | <nocturn9x> but at runtime |
11:43:39 | PMunch | Ah, then what you do works |
11:43:42 | FromDiscord | <nocturn9x> I do disable it that way, but somehow nim is still screwing my own memory manager |
11:43:46 | FromDiscord | <nocturn9x> In reply to @PMunch "Ah, then what you": except not |
11:43:49 | FromDiscord | <nocturn9x> it doesn't |
11:43:51 | PMunch | Why do you have your own garbage collector? |
11:44:04 | FromDiscord | <nocturn9x> and I know it doesn't because if I compile with `--gc:none` it works |
11:44:09 | FromDiscord | <nocturn9x> In reply to @PMunch "Why do you have": because I have my own runtime |
11:44:17 | FromDiscord | <nocturn9x> this is the bytecode VM for my language |
11:44:34 | FromDiscord | <nocturn9x> the compiler needs the GC, but the VM doesn't |
11:44:38 | FromDiscord | <nocturn9x> and idk how to turn it off |
11:44:45 | FromDiscord | <nocturn9x> (edit) "and idk how to turn it off ... " added "other than what I did already" |
11:45:02 | PMunch | You know how to turn it off, but that seems to not work (it probably does work, but something else is messing up) |
11:45:13 | PMunch | How do you allocate memory in your VM? |
11:45:22 | FromDiscord | <nocturn9x> `alloc()` |
11:45:38 | PMunch | That won't get touched by the GC whether it's on or not |
11:45:46 | FromDiscord | <Rika> you dont need to disable the GC if you're allocating raw pointers |
11:45:54 | FromDiscord | <nocturn9x> yeah I know |
11:45:56 | FromDiscord | <nocturn9x> in theory |
11:46:02 | PMunch | No, not in theory |
11:46:02 | FromDiscord | <nocturn9x> in practice nim is doing something 🤷 |
11:46:07 | FromDiscord | <nocturn9x> dude |
11:46:13 | FromDiscord | <nocturn9x> the docs say x |
11:46:15 | PMunch | I can guarantee you that the error is elsewhere |
11:46:16 | FromDiscord | <nocturn9x> my code says otherwise |
11:46:23 | FromDiscord | <Rika> i can attest to that |
11:46:25 | FromDiscord | <nocturn9x> I can guarantee you it's not |
11:46:36 | FromDiscord | <Rika> there is definitely something wrong with how you do things |
11:46:55 | FromDiscord | <nocturn9x> the issue goes away with `--gc:none` |
11:46:58 | FromDiscord | <nocturn9x> so, again, no |
11:47:00 | PMunch | It might seem like the GC is doing something bad, while being something completely different. Memory stuff can be hard to reason about |
11:47:17 | PMunch | That's not a guarantee that it's the GC's fault |
11:47:27 | PMunch | Could be a timing issue |
11:47:34 | FromDiscord | <nocturn9x> timing of what exactly? |
11:47:42 | PMunch | Execution |
11:47:53 | FromDiscord | <nocturn9x> care to elaborate? |
11:47:57 | PMunch | I haven't seen your code so it's a bit hard to reason about what might be wrong |
11:48:20 | PMunch | But it is very unlikely that it's the GC |
11:49:30 | FromDiscord | <Rika> there could be some incorrect assumption you made with how nim handles memory? |
11:49:32 | FromDiscord | <Rika> idk really |
11:49:47 | FromDiscord | <nocturn9x> the issue also goes away if I compile with `-d:danger` |
11:50:28 | FromDiscord | <Rika> hard to tell exactly what it is |
11:50:36 | PMunch | I wouldn't be as optimistic as to say it "goes away", it's probably just hiding under some rock |
11:50:52 | PMunch | Just waiting to rear its head when you least expect it |
11:51:03 | FromDiscord | <nocturn9x> could it be cuz I'm mixing ref objects and pointers |
11:51:43 | FromDiscord | <nocturn9x> I'll try to switch to regular objects and use var parameters instead |
11:52:11 | PMunch | That could definitely be causing some issues, yes |
11:52:44 | PMunch | In fact I'd be surprised if it didn't.. |
11:53:53 | FromDiscord | <Rika> mixing? as in casting? that would be disastrous yes |
11:53:59 | FromDiscord | <Rika> if you're just storing ptrs in refs thats fine |
11:54:03 | FromDiscord | <Rika> well maybe not |
11:54:12 | FromDiscord | <Rika> it would prolly at most cause leaks |
11:54:25 | FromDiscord | <Rika> and you know all the other manual mm issues you get |
11:54:26 | FromDiscord | <nocturn9x> I am storing ptrs in refs |
11:54:33 | FromDiscord | <nocturn9x> and casting said ptrs |
11:54:35 | FromDiscord | <Rika> what kind of bugs |
11:54:37 | FromDiscord | <nocturn9x> not the refs tho |
11:54:37 | FromDiscord | <Rika> oh |
11:54:40 | FromDiscord | <Rika> casting to what |
11:54:40 | FromDiscord | <nocturn9x> the ref is just an object variant |
11:54:41 | FromDiscord | <Rika> ptr T to what |
11:54:48 | FromDiscord | <nocturn9x> no it's like |
11:54:50 | FromDiscord | <nocturn9x> lemme show u |
11:54:58 | FromDiscord | <Rika> please do, thanks |
11:55:13 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKo |
11:55:20 | FromDiscord | <nocturn9x> it's just a tagged union |
11:55:53 | FromDiscord | <Rika> and HeapObject.str is cast somehow? |
11:56:24 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKp |
11:56:26 | FromDiscord | <nocturn9x> only casts occurr here |
11:56:28 | FromDiscord | <nocturn9x> (edit) "occurr" => "occur" |
11:57:02 | FromDiscord | <Rika> `sizeof(result)` for `ptr T` is always going to be byte size of pointer, not byte size of what you allocate |
11:58:09 | FromDiscord | <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:10 | FromDiscord | <Rika> i think `sizeof(HeapObject)` is what you mean |
11:58:56 | FromDiscord | <nocturn9x> what |
11:59:03 | FromDiscord | <nocturn9x> oh |
11:59:06 | FromDiscord | <nocturn9x> yeah ig |
11:59:21 | FromDiscord | <Rika> that might have been related |
11:59:51 | FromDiscord | <Rika> maybe the `reallocate` proc you have is related as well? |
12:01:47 | FromDiscord | <nocturn9x> it could be |
12:01:57 | FromDiscord | <nocturn9x> I'm trying to see if I fixed it by using var types |
12:02:19 | FromDiscord | <nocturn9x> nope |
12:02:28 | PMunch | @planetis, hmm can't find the channels documentation any longer |
12:02:33 | PMunch | When was this deprecated? |
12:03:48 | FromDiscord | <auxym> @planetis this? https://github.com/nim-lang/threading |
12:04:18 | FromDiscord | <nocturn9x> this is my reallocate function |
12:04:19 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKr |
12:05:09 | FromDiscord | <nocturn9x> btw I have a question |
12:05:48 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#ix=4eKs |
12:05:59 | FromDiscord | <nocturn9x> in this context, is `PeonVM.gc` mutable if `PeonVM` is passed as a var parameter? |
12:08:01 | PMunch | Yes |
12:08:15 | FromDiscord | <planetis> Yeah it was removed |
12:08:46 | PMunch | Just removed and not replaced? |
12:09:22 | FromDiscord | <planetis> In devel I think it's on deprecated/ but can't look now |
12:09:28 | PMunch | @nocturn9x, not sure what current and total should be, but I'm not sure you've covered all the cases there |
12:09:47 | FromDiscord | <nocturn9x> In reply to @PMunch "Yes": good |
12:09:51 | FromDiscord | <nocturn9x> In reply to @PMunch "<@523555920265871380>, not sure what": wdym? |
12:10:03 | FromDiscord | <nocturn9x> current is the total amount of memory currently allocated |
12:10:11 | FromDiscord | <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:40 | PMunch | Ah, so total always increases? |
12:16:01 | FromDiscord | <nocturn9x> yeah |
12:16:49 | FromDiscord | <nocturn9x> you thinking about overflows? |
12:16:52 | FromDiscord | <nocturn9x> Cuz I checked for that |
12:19:01 | PMunch | Nah I was mostly just curious |
12:20:28 | PMunch | @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:32 | FromDiscord | <planetis> Which one? |
12:22:05 | PMunch | This one: https://github.com/nim-lang/threading |
12:22:13 | FromDiscord | <planetis> Lol no |
12:22:23 | FromDiscord | <planetis> It's not even threadsafe |
12:22:44 | FromDiscord | <planetis> There is a gist from mratsim |
12:24:17 | PMunch | Wait what? |
12:24:17 | FromDiscord | <planetis> Try https://github.com/mratsim/weave/blob/5696d94e6358711e840f8c0b7c684fcc5cbd4472/unused/channels/channels_legacy.nim |
12:24:47 | FromDiscord | <planetis> For me even simple examples segfault |
12:24:59 | FromDiscord | <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:34 | FromDiscord | <planetis> It was mentioned in the doc comment of threading channels posted above |
12:25:49 | PMunch | Hmm, why is everything prefixed `channel_`.. |
12:26:42 | FromDiscord | <haxscramper> In reply to @planetis "It was mentioned in": You mean this one https://github.com/mratsim/weave/pull/24? |
12:26:45 | FromDiscord | <haxscramper> (edit) "https://github.com/mratsim/weave/pull/24?" => "https://github.com/mratsim/weave/pull/24 ?" |
12:28:44 | FromDiscord | <nocturn9x> In reply to @PMunch "Nah I was mostly": kk |
12:28:51 | FromDiscord | <nocturn9x> idk then I'll have to figure this out somehow |
12:28:54 | FromDiscord | <nocturn9x> valgrind ig |
12:28:56 | FromDiscord | <nocturn9x> or asan |
12:29:23 | FromDiscord | <planetis> In reply to @haxscramper "You mean this one": That's a big PR I posted the link above |
12:30:49 | PMunch | Hmm, I also have an annoying gcSafe error.. |
12:31:12 | PMunch | But Nim isn't being very specific as to why it's not gcsafe |
12:45:21 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4eKw |
12:47:58 | FromDiscord | <jmgomez> Ok, it doesnt follow --path and it seems to accept relative paths |
12:50:04 | FromDiscord | <Rika> PATH is just the literal word, you want `$PATH`? even then idt nim accepts lists delimited by colon |
12:50:40 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4eKx |
12:51:00 | FromDiscord | <jmgomez> I wanted to include an existing nim files on all the files |
12:51:24 | FromDiscord | <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:54 | FromDiscord | <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:43 | FromDiscord | <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:31 | FromDiscord | <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:44 | FromDiscord | <ElementalX> thank you! checking it out! |
16:28:18 | FromDiscord | <lantos> sent a long message, see http://ix.io/4eLo |
16:29:59 | FromDiscord | <lantos> Also the seq initialisation seems to be slower :/ |
16:30:18 | FromDiscord | <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:10 | FromDiscord | <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:21 | FromDiscord | <prestosilver> kinda op |
16:37:25 | FromDiscord | <Rika> You can run blocks of code in a default parameter |
16:37:39 | FromDiscord | <Rika> As long as it returns a value |
16:38:23 | FromDiscord | <prestosilver> rly thats sick, i think the closest ive done is like a const or nil but never tried that lol |
16:45:45 | FromDiscord | <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:22 | FromDiscord | <huantian> actually I have no idea how thi sworks |
16:50:37 | FromDiscord | <lantos> set would add uniqueness and also a hash comp |
16:51:49 | FromDiscord | <huantian> yeah.. |
16:52:16 | FromDiscord | <huantian> huh this nim code is interesting |
16:52:17 | FromDiscord | <huantian> maybe I'll try optimizing |
16:53:31 | FromDiscord | <lantos> i did a perf on it, its the $ being slow mainly |
16:53:48 | FromDiscord | <huantian> perhaps there's a better way to generate the output? |
16:53:56 | FromDiscord | <huantian> what format is it expected to be in |
16:55:26 | FromDiscord | <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:09 | FromDiscord | <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:56 | FromDiscord | <huantian> hmmm I feel like the fast way to get leading digits would just be to use math and not str manips |
16:59:08 | FromDiscord | <huantian> but yeah someone might have a better int -> string converter |
17:01:51 | FromDiscord | <lantos> In reply to @Rika "You can run blocks": 😮 |
17:06:05 | FromDiscord | <sdmcallister> sent a code paste, see https://play.nim-lang.org/#ix=4eLC |
17:08:43 | FromDiscord | <lantos> your code comment broke |
17:10:53 | FromDiscord | <lantos> how big is your csv? |
17:11:15 | FromDiscord | <sdmcallister> not very big, about 4000 rows. its all the api calls that take forever |
17:11:24 | FromDiscord | <lantos> youd want chunking and for something like this also threading to hand the processing off |
17:11:31 | FromDiscord | <lantos> read the whole csv first |
17:11:55 | FromDiscord | <lantos> (edit) "first" => "first, can the api call be called in parallel?" |
17:13:03 | FromDiscord | <sdmcallister> yeah, I believe so. |
17:18:56 | FromDiscord | <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:20 | FromDiscord | <lantos> dang thats a long time for an api call |
17:35:11 | FromDiscord | <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:17 | FromDiscord | <huantian> An asynchronous semaphore might work |
17:40:30 | FromDiscord | <huantian> I tried copying one from python before, but there isn’t any in the Nim stdlib |
17:44:57 | FromDiscord | <lantos> httpfetch library should work fine |
17:45:16 | FromDiscord | <lantos> unless you need to process the chunked data |
18:09:27 | * | wallabra joined #nim |
18:20:35 | NimEventer | New 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:59 | FromDiscord | <ShalokShalom> In reply to @prestosilver "I was today years": Can you tell me, which theme/editor that is? |
18:31:07 | FromDiscord | <ShalokShalom> Looks neat with Nim. |
18:31:56 | FromDiscord | <prestosilver> vscode with the dracula theme and nim plugin |
18:34:16 | FromDiscord | <ShalokShalom> Thanks |
18:34:33 | FromDiscord | <ShalokShalom> The saem one? |
18:35:02 | FromDiscord | <ShalokShalom> Just asking, since it's the most fresh, and the other one is ranking higher on vscode search results. |
18:35:21 | FromDiscord | <huantian> yep saem one |
18:36:10 | FromDiscord | <prestosilver> actually im using the top one bc the other one lags vscode for me if i remember right |
18:36:36 | FromDiscord | <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:02 | FromDiscord | <ShalokShalom> There are actually a couple ones. |
18:43:03 | * | jjido joined #nim |
18:43:17 | FromDiscord | <ShalokShalom> Saem should not lag, maybe you got a third, different one? |
18:46:24 | FromDiscord | <prestosilver> yea idk ill check it out, i may have been using alt before |
19:46:52 | FromDiscord | <ezquerra> I'd be nice if there was an official VSCode plugin, published by the nim team |
19:46:55 | FromDiscord | <ezquerra> (edit) "I'd" => "It'd" |
20:04:26 | * | krux02_ joined #nim |
20:25:10 | FromDiscord | <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:32 | FromDiscord | <ShalokShalom> So we can't take it down, and everybody looking for 'Nim' plugins, will see it first |
20:25:44 | FromDiscord | <ShalokShalom> So they download it, and the cycle succeeds |
20:26:14 | FromDiscord | <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:00 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMl |
21:12:42 | FromDiscord | <Elegantbeef> The lines iterator is actually quite slow iirc |
21:14:42 | FromDiscord | <ElegantBeef> Uh oh matrix bridge is dieded |
21:14:52 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=4eMm is quicker than nim's builtin `lines` |
21:15:10 | FromDiscord | <ElegantBeef> But i assume it doesnt cover all the same thing as Nim's builtin lines |
21:20:30 | FromDiscord | <4zv4l> yeah the difference is quite huge |
21:21:27 | FromDiscord | <4zv4l> oh yeah I forgot about `iterators` hand made function |
21:21:49 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> Suffice to say it'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:09 | FromDiscord | <4zv4l> I was just wondering one thing |
21:23:47 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMo |
21:23:53 | FromDiscord | <4zv4l> if it does (I can be wrong) |
21:24:06 | FromDiscord | <Elegantbeef> Cause Nim is safer |
21:24:19 | FromDiscord | <Elegantbeef> `s[a..b]` allocating means the slice can outlive `s` |
21:24:38 | FromDiscord | <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:07 | FromDiscord | <Elegantbeef> Nim doesnt have a borrow checker by default so `toOpenArray` can only be used to pass to procedures |
21:25:34 | FromDiscord | <Elegantbeef> sent a long message, see http://ix.io/4eMq |
21:25:47 | FromDiscord | <Elegantbeef> Well i guess i need to fix element cause cinny is causing a fucking headache to you guys |
21:26:12 | FromDiscord | <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:37 | FromDiscord | <4zv4l> or right, the element bridge 😆 |
21:26:50 | FromDiscord | <4zv4l> In reply to @sOkam! "you will be amazed": yeah it's really nice indeed just |
21:26:54 | FromDiscord | <4zv4l> I guess that's slower |
21:26:59 | FromDiscord | <4zv4l> since for each slice it allocates memory |
21:28:35 | * | derpydoo quit (Quit: derpydoo) |
21:29:09 | FromDiscord | <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:07 | FromDiscord | <Elegantbeef> I mean that's what a borrow checker is for |
21:32:18 | FromDiscord | <4zv4l> doesn't Nim kinda have one ? |
21:32:29 | FromDiscord | <Elegantbeef> It does have an experimental one |
21:32:33 | FromDiscord | <Elegantbeef> It doesnt have a stable usable one |
21:33:16 | FromDiscord | <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:39 | FromDiscord | <4zv4l> never used gdb on a gc language before, just in case, maybe that's why it confused me |
21:33:49 | FromDiscord | <Elegantbeef> nim main exists for a multitude of reasons |
21:34:09 | FromDiscord | <sOkam!> Is there anything in Nim similar to python's `pathlib`? |
21:34:30 | FromDiscord | <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:47 | FromDiscord | <Elegantbeef> I swear people really need to explain what modules are from X language when they ask |
21:34:56 | FromDiscord | <Elegantbeef> I now have to look up pathlib to see what the hell that is |
21:35:17 | FromDiscord | <Elegantbeef> Type safe paths |
21:35:17 | FromDiscord | <sOkam!> its just a path management lib, that uses Path type instead of strings |
21:35:23 | FromDiscord | <sOkam!> yeah, pretty much |
21:35:31 | FromDiscord | <Elegantbeef> https://nimble.directory/search?query=path |
21:35:42 | FromDiscord | <Elegantbeef> Nim2.0 will have typesafe paths 😄 |
21:36:53 | FromDiscord | <4zv4l> Nim 2.0 ? will it be like Python and changes lot of things or will be a sweet update ? |
21:37:23 | FromDiscord | <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:26 | FromDiscord | <Elegantbeef> I mean Araq wants it out this year |
21:37:31 | * | jmdaemon joined #nim |
21:38:01 | FromDiscord | <Elegantbeef> But yea typesafe path https://github.com/nim-lang/Nim/blob/devel/lib/std/paths.nim |
21:39:59 | FromDiscord | <4zv4l> In reply to @Elegantbeef "If you want to": yeah right I saw `nimMain` `nimMainModules` `nimMainInner` |
21:40:14 | FromDiscord | <4zv4l> and the actual code is in `NimMainModule` right ? |
21:40:19 | FromDiscord | <4zv4l> (edit) "`nimMainModules`" => "`nimMainModule`" |
21:40:40 | FromDiscord | <dlesnoff> Sorry in advance if it feels a bit offtopic |
21:40:49 | FromDiscord | <dlesnoff> sent a code paste, see https://play.nim-lang.org/#ix=4eMt |
21:41:19 | FromDiscord | <dlesnoff> (edit) "https://play.nim-lang.org/#ix=4eMt" => "https://play.nim-lang.org/#ix=4eMu" |
21:41:58 | FromDiscord | <dlesnoff> I guess I should write this script in Nim directly if I seek help in this channel 😅 |
21:42:35 | FromDiscord | <dlesnoff> (edit) "https://play.nim-lang.org/#ix=4eMu" => "https://play.nim-lang.org/#ix=4eMv" |
21:46:40 | FromDiscord | <dlesnoff> I guess I will handle it myself, by converting it into Nim |
22:02:56 | FromDiscord | <Elegantbeef> Yea it's very confusing why you wouldnt just make your own Nim file to do this |
22:03:11 | FromDiscord | <Elegantbeef> Something like that↵(@4zv4l) |
22:06:34 | PMunch | Hmm, 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:41 | FromDiscord | <Elegantbeef> uh huh |
22:20:33 | FromDiscord | <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:10 | PMunch | Hmm, I think it might be a cross |
22:21:13 | PMunch | Oops |
22:21:22 | PMunch | I think it might be a cross-module issue |
22:22:14 | FromDiscord | <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:28 | FromDiscord | <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:08 | PMunch | I mean the issue is with code like this: http://ix.io/4eMB |
22:25:29 | PMunch | But 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:57 | FromDiscord | <Elegantbeef> Were you perhaps using some code in such a way that'd require it at runtime? |
22:30:02 | FromDiscord | <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:13 | FromDiscord | <4zv4l> is it normal that the `test` in my source code are still being executed when compiling in `release` ? |
22:31:54 | FromDiscord | <Elegantbeef> 'the test'? |
22:32:18 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMD |
22:32:32 | FromDiscord | <4zv4l> `Basic tests` is being run even when I compile this as `--d:release` |
22:32:35 | FromDiscord | <Elegantbeef> Well yea it should be getting ran you dont have any defines |
22:32:59 | FromDiscord | <4zv4l> I thought it would skip test in release mode |
22:33:05 | PMunch | Nope, 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:09 | FromDiscord | <Elegantbeef> Nope you might want to test code in release |
22:33:27 | PMunch | compileTime on types would be great |
22:33:42 | FromDiscord | <4zv4l> how can I check like↵`when isNotRelease` ? |
22:33:43 | FromDiscord | <Elegantbeef> Seems like the const folding might be having a drink |
22:33:54 | FromDiscord | <Elegantbeef> `when not defined(release)` |
22:33:58 | FromDiscord | <Elegantbeef> or just make a test directory like a sane person |
22:34:19 | FromDiscord | <Elegantbeef> But then again you arent doing `import std/[strutils, strformat, unittest]` so i take back the sane comment |
22:34:40 | FromDiscord | <Elegantbeef> Well pmunch if you get a min repo i'll take a look |
22:34:45 | FromDiscord | <4zv4l> In reply to @Elegantbeef "or just make a": I'll probably do this yeah |
22:34:55 | FromDiscord | <4zv4l> In reply to @Elegantbeef "But then again you": wdym ? |
22:35:25 | FromDiscord | <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:46 | FromDiscord | <Elegantbeef> You're not prefixing `std` on the stdlib modules and have multiple lines for no reason |
22:37:06 | FromDiscord | <Elegantbeef> Yours can accidently import the wrong module |
22:37:23 | FromDiscord | <Elegantbeef> if you have a module with the same name next to this module it imports that over the stdlib |
22:38:01 | FromDiscord | <Elegantbeef> The convention is to prefix all stdlib modules with `std/` as all new ones will require it |
22:38:50 | PMunch | Hmm, 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:12 | FromDiscord | <4zv4l> In reply to @Elegantbeef "The convention is to": I'll take that habits, thanks ! |
22:39:15 | FromDiscord | <4zv4l> (edit) "habits," => "habit," |
22:39:25 | PMunch | So it's almost like the `readFrom` procedure doesn't understand that the input can be static.. |
22:39:47 | FromDiscord | <luteva> sent a long message, see http://ix.io/4eMG |
22:39:59 | FromDiscord | <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:32 | FromDiscord | <Elegantbeef> I dont really do ECS, but i'm sure @rlipsc would recommend it |
22:41:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4eMH |
22:41:17 | FromDiscord | <Elegantbeef> Recursive type defs need to be in the same type block |
22:41:36 | FromDiscord | <Elegantbeef> Well this isnt even recursive but anyway |
22:41:47 | FromDiscord | <Elegantbeef> Use single type defs to safe your sanity |
22:44:47 | FromDiscord | <Elegantbeef> Oh pmunch i might know the issue |
22:45:03 | FromDiscord | <Elegantbeef> a dot expression might be considered not simple |
22:45:12 | PMunch | Hmm |
22:46:03 | PMunch | But the object is `static[Device]` |
22:46:11 | PMunch | So why does it create a runtime copy of it? |
22:46:28 | FromDiscord | <Elegantbeef> Like i said the code folding only considers simple statements |
22:46:45 | FromDiscord | <Elegantbeef> if you do `static(x.device.address)` it properly works as you noted |
22:48:08 | PMunch | Indeed |
22:48:32 | FromDiscord | <Elegantbeef> So this means the constant folding is failing to identify the simplicity |
22:48:42 | FromDiscord | <Elegantbeef> Which makes me think https://github.com/nim-lang/Nim/blob/devel/compiler/ccgexprs.nim#L1146 is the problem |
22:50:08 | PMunch | Hmm, possibly |
22:50:40 | FromDiscord | <Elegantbeef> Actually that might not be used anymore |
22:50:41 | PMunch | I'll have to find a way to create a minimal sample to test it |
22:50:59 | FromDiscord | <Elegantbeef> I mean what you provided was good enough |
22:51:12 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#ix=4eMI |
22:51:19 | PMunch | Oh wait |
22:51:37 | PMunch | @Elegantbeef, if you compile that sample with --gc:arc it shows the behaviour I was talking about |
22:51:54 | FromDiscord | <Elegantbeef> Yea that's what i always use for small examples 😛 |
22:52:12 | FromDiscord | <Elegantbeef> Arc makes looking at the Nim code gen much easier |
22:52:27 | FromDiscord | <Elegantbeef> `--mm:arc -d:danger` is relatively readable |
22:54:00 | FromDiscord | <dlesnoff> I do not manage to write a new file |
22:54:14 | FromDiscord | <dlesnoff> (edit) "I do not manage to write a new file ... " added "in Nim." |
22:54:21 | FromDiscord | <Elegantbeef> `isSimpleExpr` is not used anymore |
22:54:23 | FromDiscord | <Elegantbeef> So shucks |
22:55:00 | FromDiscord | <dlesnoff> writeFile(filename, string) does not create a new file, I am so confused. |
22:55:36 | FromDiscord | <dlesnoff> Is this outdated https://nim-by-example.github.io/files/ ? |
22:55:50 | FromDiscord | <Elegantbeef> It certainly will |
22:56:00 | * | PMunch quit (Ping timeout: 252 seconds) |
22:56:41 | FromDiscord | <dlesnoff> Yes but I mean for 1.6.8 it should not be outdated right ? |
22:57:06 | FromDiscord | <dlesnoff> It says that writeFile creates a new File if filename doesn't exist |
22:57:33 | FromDiscord | <Elegantbeef> Which it does |
22:59:06 | FromDiscord | <luteva> so there seems to be some special notation for seq[Email] in norm. Anyone knows? |
22:59:56 | FromDiscord | <Elegantbeef> @Phil\: would know, but i assume they're presently asleep |
23:01:03 | FromDiscord | <luteva> ok thx! gonna ask again later, maybe he is back then.... |
23:03:22 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMP |
23:04:39 | FromDiscord | <Elegantbeef> `raise newException(ExceptionType, "This is a custom error")` |
23:04:57 | FromDiscord | <Elegantbeef> It's highly suggested to make your own exception to allow users to specify the error, unless a builtin one suffices |
23:06:23 | FromDiscord | <4zv4l> like making a Exception kinda enum available so when people import my lib they can see the exception that can happen ? |
23:07:49 | FromDiscord | <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:04 | FromDiscord | <Elegantbeef> Ok Pmunch i think i see the issue, it loses it's staticness |
23:08:21 | FromDiscord | <Elegantbeef> It's transformed into `discard readFrom(Device(bus: Bus(), address: 100'u).address)` |
23:08:37 | FromDiscord | <pmunch> Exactly |
23:09:04 | FromDiscord | <Elegantbeef> Which means it's likely before codegen |
23:09:43 | FromDiscord | <pmunch> Damn it, I posted a bunch of messages. But apparently I had disconnected from IRC.. |
23:11:21 | FromDiscord | <pmunch> I had even created code pastes with the outputs.. |
23:11:31 | FromDiscord | <pmunch> And a version with the template |
23:11:53 | FromDiscord | <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:30 | FromDiscord | <Elegantbeef> Yea i'm ripping the compiler apart so it's fine pmunch 😄 |
23:14:45 | FromDiscord | <pmunch> sent a long message, see http://ix.io/4eMT |
23:14:47 | FromDiscord | <pmunch> That's the log from my IRC client |
23:15:24 | FromDiscord | <pmunch> In case it helps |
23:16:11 | FromDiscord | <Elegantbeef> It doesnt sadly, but alas |
23:16:12 | FromDiscord | <Elegantbeef> Buh bye |
23:16:19 | FromDiscord | <pmunch> Bye |
23:16:59 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4eMU |
23:18:16 | FromDiscord | <Elegantbeef> No |
23:18:21 | FromDiscord | <Elegantbeef> `lines(fileName)` will |
23:18:48 | FromDiscord | <4zv4l> In reply to @Elegantbeef "`lines(fileName)` will": will it still be an iterator and not read the whole file once ? |
23:19:28 | FromDiscord | <Elegantbeef> It's an iterator |
23:19:33 | FromDiscord | <Elegantbeef> How do i say RTFM nicely? 😛 |
23:20:47 | FromDiscord | <4zv4l> can always ask just in case xD |
23:21:46 | FromDiscord | <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:55 | FromDiscord | <pmunch> Hmm, I wonder if there is a better way to structure a static/dynamic type duo like that.. |
23:26:13 | FromDiscord | <Elegantbeef> I mean this is fine pmunch there is just an issue with the sem checker |
23:26:59 | FromDiscord | <Elegantbeef> How would you close the file though 4zv4l |
23:27:16 | * | jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…) |