<< 10-02-2024 >>

00:26:52*casaca joined #nim
00:40:54*azimut joined #nim
00:51:25*rockcavera quit (Remote host closed the connection)
00:51:50termerWorking on a version of the deques module that's statically allocated
00:52:32FromDiscord<Elegantbeef> You really like value types 😄
00:52:38termerabsolutely
00:52:56termerI was a little disappointed when I checked and saw the stdlib one only supports seq
00:53:04FromDiscord<Elegantbeef> Bleh
00:53:13FromDiscord<Elegantbeef> It's not the biggest issue, but have fun
00:53:22termersomeone will find it useful
00:53:30FromDiscord<Elegantbeef> Girvo might 😛
00:53:35termerwhat's he do again
00:54:28FromDiscord<Elegantbeef> Embedded stuff professionally
00:54:46termerman I wish I did that for my job
00:54:50termerwith Nim specifically
00:55:09FromDiscord<Elegantbeef> Move to Australia and beg him
00:55:19termerhahahaha
00:55:26termerhell no, not living in austalia
00:55:42termerI had the idea for a static deque library while working on another HTTP parser
00:59:20FromDiscord<demotomohiro> I also implemented a version of the deque that uses array instead of seq for reciving data from UART on raspberry pi pico.
01:00:00termerwhere is your implementation?
01:00:04termerI'll use that instead of making my own
01:00:07termerI was just modifying the stdlib module
01:16:22FromDiscord<demotomohiro> It is not on public yet. I will upload it on repo later.↵It still has a few procs as I use it as simple queue.
01:53:32*jmdaemon joined #nim
02:01:02nmzcan nim do GUIs?
02:02:59FromDiscord<Elegantbeef> You can use many GUI libraries from Nim no different to C/C++/Rust/...
02:03:56nmzI haven't seen any GUI on rust yet
02:04:28FromDiscord<Elegantbeef> Rust has plenty of in language GUIs, but also bindings to Qt, GTK, WX, and so forth
02:06:56nmzhttps://areweguiyet.com/ they should probably update this then
02:08:26FromDiscord<Elegantbeef> I mean they list plenty of packages
02:08:42FromDiscord<Elegantbeef> > There are a number of bindings available today to existing frameworks, but those looking for a mature, easy to use, and completely Rust-based solution will most likely find themselves out of luck.
02:08:52FromDiscord<zumi.dxy> i find wNim to be a pretty good gui library↵binds to win32 GUI stuff
02:09:03nmzlisting doesn't mean anything, hell I just went through like 8 GUI packages for lua, only 1 worked
02:09:07FromDiscord<Elegantbeef> I find owlkettle nice if we're giving our opinions
02:09:18FromDiscord<zumi.dxy> I just cross compile with mingw :p
02:09:25FromDiscord<Elegantbeef> Cool, but the simple fact is that you can use gtk from Rust 😄
02:09:50FromDiscord<zumi.dxy> I wanna try out the qt bindings however
02:09:51FromDiscord<Elegantbeef> Whether it's an idiomatic solution is another thing
02:09:57FromDiscord<zumi.dxy> (forgot what it's called)
02:44:50FromDiscord<varriount> Gr. I should really just write a cone of Python's standard library in Nim. I'm too used to it.
02:45:32arkanoidplease help me, I'm seeking a bug I'm facing into nimlang server, but I'm ending up into a wall. I need a recap on how a process is killed by parent in C, and what Zombie really means
02:47:16arkanoidI have nimlangserver that kills nimsuggest children. It turns them into Zombie, but then parent (nimlangserver) hangs forever on call `close(FileStream(s))` where close is stdio.h fclose, and s in nimsuggest process.errStream
03:38:12termernmz What do you want to make
03:38:21termerthere are many GUI libraries, all at varying levels of completeness
04:14:22FromDiscord<themannyzaur> sent a long message, see https://pasty.ee/AFraEKlSfbIa
04:14:37FromDiscord<themannyzaur> (edit) "long message," => "code paste," | "https://pasty.ee/HDjObwbpnFEU" => "https://play.nim-lang.org/#pasty=zaPMwHFFfVYs"
04:15:08FromDiscord<themannyzaur> sent a code paste, see https://play.nim-lang.org/#pasty=LsifKjeUuFLE
04:20:05FromDiscord<Elegantbeef> You have two while loops 😄
04:21:10FromDiscord<themannyzaur> Is that bad?
04:21:35FromDiscord<themannyzaur> What would you recommend?
04:21:35FromDiscord<Elegantbeef> Nested while loops are generally a code smell
04:22:38FromDiscord<Elegantbeef> `std/parseutils` has a nice `parseUntil`
04:22:47FromDiscord<Elegantbeef> But that's just be being odd
04:23:10FromDiscord<Elegantbeef> the `'$` inside the while loop case will never be hit
04:23:25FromDiscord<Elegantbeef> Since you do `contents[pos] != '$'`
04:27:23FromDiscord<themannyzaur> sent a long message, see https://pasty.ee/UvdjZntmvfRF
04:27:27FromDiscord<Elegantbeef> You double inc the pos when iterating for `"`
04:28:24FromDiscord<themannyzaur> I skip the current character which is " at that point so that I can print whatever is between two quotes
04:28:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=OCvgLOfBkOKk
04:32:44FromDiscord<themannyzaur> Thanks for this but it has similar problem as the original; $ is read and in this case printed
04:32:48FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=OhwXwsNvGrPe this might be "more proper"
04:33:09*rockcavera joined #nim
04:33:33FromDiscord<Elegantbeef> Eh I might just be brain tired and writing bad code
04:35:33FromDiscord<themannyzaur> Honestly might be the same for me 😂↵It's 4am and I've been skimming the docs to crank this out↵With some sleep I might come back to this and see where the issues are
04:35:41FromDiscord<themannyzaur> In reply to @Elegantbeef "https://play.nim-lang.org/#pasty=OhwXwsNvGrPe this ": Looking at this now
04:38:35FromDiscord<Elegantbeef> You'd probably want to make a function and have that iterate over instead of doing the parseutils
04:42:10FromDiscord<themannyzaur> In reply to @Elegantbeef "https://play.nim-lang.org/#pasty=OhwXwsNvGrPe this ": This works like intended↵I'll take a closer look
04:42:18FromDiscord<Elegantbeef> Oh i'm daft
04:42:22FromDiscord<themannyzaur> In reply to @Elegantbeef "You'd probably want to": Any reason?
04:42:23FromDiscord<Elegantbeef> It's hitting the `\n` after the `"'`
04:42:37FromDiscord<Elegantbeef> Parseutils allocates to a string
04:43:04FromDiscord<themannyzaur> In reply to @Elegantbeef "Parseutils allocates to a": Buf?
04:43:10FromDiscord<Elegantbeef> yes
04:43:47FromDiscord<themannyzaur> I don't understand
04:44:07FromDiscord<themannyzaur> I've read the docs but i don't get why that's an issue here
04:44:23FromDiscord<Elegantbeef> Ok so disregard the parseutils comment
04:44:33FromDiscord<Elegantbeef> my doing `+ 1` skips the issue
04:44:40FromDiscord<Elegantbeef> There is a `\n$` in your string
04:44:53FromDiscord<Elegantbeef> So after it reads the quote it hits a `'\n` and hits the unexpected value
04:45:10FromDiscord<Elegantbeef> Your case statement does not handle `'\n`
04:45:19FromDiscord<Elegantbeef> `'\n'`\
04:45:33FromDiscord<themannyzaur> Ahhh yeah↵I thought about this but I ruled it out because I assumed it just goes straight to a newline
04:46:00FromDiscord<themannyzaur> So that was what triggered the value not recognised statement
04:46:20FromDiscord<Elegantbeef> Coincidentally your belief that it was hitting `$` and else caused me to go in full on "You're shitting me" putting me in a state of disbelief and bad logic
04:48:08FromDiscord<themannyzaur> Ah I see↵I'll put this on hold at this point↵Get some sleep and view this again with a refreshed brain
04:48:39FromDiscord<themannyzaur> Thanks a lot↵Learned a few things this session 👍🏾
07:19:15*advesperacit joined #nim
08:56:52*cnx quit (Ping timeout: 255 seconds)
09:02:55*cnx joined #nim
09:09:57FromDiscord<zumi.dxy> I wonder how NimScript works↵and if there's a way to shorten the startup time
09:10:13FromDiscord<zumi.dxy> it still has to compile everything right?
09:32:43*cm quit (Ping timeout: 256 seconds)
09:32:52*cm_ joined #nim
09:33:16*cm_ is now known as cm
09:56:19*derpydoo joined #nim
10:01:27FromDiscord<Elegantbeef> @zumi.dxy there are some ways to reduce the compile time(not that I use them in nimscripter atm)
10:02:33FromDiscord<Elegantbeef> Using `evalScript` on the interpreter gets you partial recompilation
10:32:27FromDiscord<grumblygibson> sent a code paste, see https://play.nim-lang.org/#pasty=ArAwYQbkzsyo
10:48:28FromDiscord<that_dude.> There's a desync between https://nim-lang.org/docs/manual_experimental.html and https://nim-lang.github.io/Nim/manual_experimental.html#member-pragma. I was ripping my hair out looking for this lol
10:49:06FromDiscord<that_dude.> Well I guess not really cus it says the version on the top, but I was just assuming latest
10:49:12FromDiscord<that_dude.> BUT still lol
11:22:23*cm quit (Ping timeout: 260 seconds)
11:22:59*cm joined #nim
12:02:31FromDiscord<kiloneie> Can you use the "using" statement with generics ? If yes, how ? I can't find examples of the "using" statement.
12:18:38FromDiscord<odexine> In reply to @kiloneie "Can you use the": https://nim-lang.org/docs/manual.html#statements-and-expressions-using-statement for examples
12:19:53FromDiscord<odexine> I assume you cannot use unresolved generics in them (ie AType[T]) but can use resolved (ie Another[int])
12:51:12*tc424 quit (Ping timeout: 268 seconds)
12:52:04*tc424 joined #nim
12:54:18Amun-Raif you're writing module for people to use, try to avoid using
12:55:58Amun-Rahttps://postimg.cc/18Sr864T
12:58:46arkanoidwhen killing a child process, what is the sequence? kill > waitForExit > close, or just kill > waitForExit, kill > close > waitFor exit ?
13:06:01Amun-Raif you don't need exit code, and you don't, kill, close
13:09:41arkanoidAmun-Ra: I'm debugging a futex infinite wait inside nimlangserver. Parent kills child, which goes Zombie, parent calls close on child.stdErr > parent goes infinite futex private wait accoridng to strace
13:10:34arkanoidif I don't call close but just kill() > wait() the process terminates correctly, but the original cose is kill() > close() https://github.com/nim-lang/langserver/issues/184
13:10:55arkanoidparent is nimlangserver, child is nimsuggest
13:13:30arkanoidthis is the line where my nimlangserver process waits forever when I close the IDE https://github.com/nim-lang/langserver/blob/3eb83dabfba18f079fca72f1b72199f01beb13b5/suggestapi.nim#L251
13:15:27arkanoidmy question is: if child process is already killed (Zombie state according to /proc/<pid>/status), and parent calls close on zomieprocess.stdErr, why does it wait forever?
13:16:45arkanoidexactly this line: https://github.com/nim-lang/Nim/blob/a45f43da3407dbbf8ecd15ce8ecb361af677add7/lib/pure/osproc.nim#L1196
13:25:20arkanoid I basically have no idea what the parent is waiting on, if the child process is Zombie
13:37:12*junaid_ joined #nim
13:46:01*jmdaemon quit (Ping timeout: 264 seconds)
13:51:10*derpydoo quit (Ping timeout: 255 seconds)
13:54:01*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
13:56:08FromDiscord<Robyn [She/Her]> Debating on making a `read` macro... Hm....
14:11:32*SchweinDeBurg joined #nim
14:52:40arkanoidhm, I found the issue. There's a thread of the parent process waiting/reading child process stderr via `process.errorStream.readLine'. When the parent kills that child process, the threads receives no events and stays stuck on very same `process.errorStream.readLine' line, and when parent process calls `close` on zombified child process stdErr stream, parent hangs waiting for his tread to release the
14:52:42arkanoidresource, leaving the system in a deadlock
14:53:46arkanoidwhat's the proper way to stop reading from `process.errorStream.readLine' when the process gets killed?
15:01:50*azimut quit (Ping timeout: 255 seconds)
15:23:12*Goodbye_Vincent quit (Quit: )
15:24:06*Goodbye_Vincent joined #nim
15:35:57FromDiscord<demotomohiro> @Arkanoid↵https://www.man7.org/linux/man-pages/man7/pipe.7.html↵Nonblocking I/O
15:36:38FromDiscord<demotomohiro> > If all file descriptors referring to the write end of a pipe have↵> been closed, then an attempt to read(2) from the pipe will see↵> end-of-file (read(2) will return 0).
15:37:34FromDiscord<demotomohiro> If you want to kill child process without waiting for child process close pipe, you probably need to use Nonblocking I/O or something like epoll.
15:40:43arkanoiddemotomohiro: I'm just debugging an issue that is present in official nimlangserver, the original design on how to talk to children nimsuggest processes is not my idea
15:41:08arkanoida barely know how things works under the hood, just doing some educated guesses
15:41:40arkanoidall I know is that if I don't run the thread that reads stderr, the kill and close runs correctly
15:42:18arkanoidmy head is puzzled here if the problem is a read that should not be reading, or a write that should not be writing
16:03:56*PMunch joined #nim
16:18:19*om3ga joined #nim
16:20:38*eagledot joined #nim
17:05:24*eagledot quit (Quit: Leaving)
17:05:42FromDiscord<summarity> how can I set multiple search paths in a nim config
17:07:40FromDiscord<summarity> Ah, just add multiple path arguments
17:24:19*junaid_ quit (Remote host closed the connection)
17:52:48*azimut joined #nim
18:02:17*azimut quit (Ping timeout: 255 seconds)
18:43:50*azimut joined #nim
18:58:14*rockcavera quit (Read error: Connection reset by peer)
18:58:59*rockcavera joined #nim
19:12:25FromDiscord<Robyn [She/Her]> https://play.nim-lang.org/#pasty=HjxWaaXEupRR hm, not sure why this isn't working... It's supposed to allow you to create types for 'events' to be ran, but here it doesn't seem to allow that
19:12:45FromDiscord<Robyn [She/Her]> (edit) "ran, but here it doesn't seem to allow that" => "ran"
19:12:58FromDiscord<Robyn [She/Her]> But for some reason, it doesn't even register the function
19:13:40*junaid_ joined #nim
19:16:07*junaid_ quit (Client Quit)
19:16:34*junaid_ joined #nim
19:18:55FromDiscord<Robyn [She/Her]> Oh wait I think I know?
19:19:41FromDiscord<MDuardo> Anybody was able to run nimlangserver in Helix?
19:19:42FromDiscord<MDuardo> It crashes for me when opening a file
19:19:59FromDiscord<Robyn [She/Her]> In reply to @chronos.vitaqua "Oh wait I think": Yep fixed
19:25:12FromDiscord<MDuardo> How do you update?↵I have Nim instaled by choosenim and Nimble binaries are added to PATH
19:26:09FromDiscord<nnsee> In reply to @MDuardo "How do you update?": update Nim you mean?
19:26:39FromDiscord<nnsee> `choosenim update stable` is a thing
19:29:38FromDiscord<MDuardo> No, upgrade nimlangserver to be able to now get it to work on Helix↵(@nnsee)
20:41:06FromDiscord<Robyn [She/Her]> https://play.nim-lang.org/#pasty=VbXExEVRPBaP anyone able to give a reason on why I shouldn't use something like this for an event system? It does mess with pointers so...
20:41:55FromDiscord<Robyn [She/Her]> The output gets truncated on the playground for some reason, but on my PC it runs great
20:42:53FromDiscord<Robyn [She/Her]> Hey Beef, able to provide valuable insight on why I shouldn't use an event system that uses pointers and `getTypeInfo` to register/call listeners?
20:46:53FromDiscord<morgan> what's the best way to iterate thru a seq while removing items from it? i have a bunch of objects that reference some others, and i need to remove all connected objects at once, only processing that cluster once
20:48:00FromDiscord<Robyn [She/Her]> In reply to @morganalyssa "what's the best way": I'd say use some sort of counter
20:48:19FromDiscord<morgan> yeah i was thinking about using a while loop and finding the next existing item
20:48:58FromDiscord<odexine> loop in reverse
20:49:25FromDiscord<Robyn [She/Her]> Thaaat's smarter
20:49:50FromDiscord<morgan> it will have to jump back in larger jumps then
20:50:05FromDiscord<morgan> vs just grabbing the first element
20:50:06FromDiscord<odexine> I’m not too sure I understand the structure of your problem
20:50:16FromDiscord<morgan> lemme see if i can draw something
20:51:27*gooba quit (Remote host closed the connection)
20:53:29FromDiscord<morgan> https://media.discordapp.net/attachments/371759389889003532/1205979875970646036/image.png?ex=65da5748&is=65c7e248&hm=f0446521142f4b7ed37151f8daa5b25c6220178ac353c55365670d867695b5ad&
20:53:47FromDiscord<morgan> i need to iterate thru and remove all the green dots connected with red lines
20:53:55FromDiscord<morgan> and then go onto the next set
20:55:48FromDiscord<odexine> It seems it would be quicker to iterate, check connection, if none add to separate sequence
20:56:04FromDiscord<odexine> Since it’s dense with connected components
20:56:43*gooba joined #nim
20:57:49FromDiscord<morgan> the problem is then each time i go thru a new row, i have to traverse a graph to see if i have visited it, rather than traversing each graph once
21:07:16FromDiscord<Elegantbeef> I mean I built an ECS off of using `getTypeInfo` so why would I↵(@Robyn [She/Her])
21:09:16FromDiscord<Robyn [She/Her]> 🤷‍♀️ was just wondering if this could be a bad idea somehow
21:09:35FromDiscord<Elegantbeef> It's type erased so you need to have checks to ensure the types match
21:09:49FromDiscord<Elegantbeef> But you can throw together an event listener relatively easily using typeinfo
21:10:04FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "It's type erased so": That's what the code does yep
21:10:24FromDiscord<Elegantbeef> Do you accept all procedure types?
21:10:44FromDiscord<Robyn [She/Her]> It checks the procedure against the type you're registering an event for
21:10:52FromDiscord<Robyn [She/Her]> So yep I think if I understand that correctly
21:10:59FromDiscord<Robyn [She/Her]> No
21:11:06FromDiscord<Robyn [She/Her]> Also, it checks the parameters too
21:11:26FromDiscord<Elegantbeef> I mean can you do `events.add proc(a, b: int, c: string) = echo "hello"` and `events.add proc(a: int): float`?
21:11:29FromDiscord<Robyn [She/Her]> I'm so tired I'm struggling to explain
21:11:39FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "I mean can you": Ah okay, no you can't do that
21:17:15FromDiscord<Elegantbeef> So what type events can you subscribe?
21:17:16FromDiscord<Elegantbeef> Do they have to have the same arity and return type?
21:17:19FromDiscord<Elegantbeef> Using https://github.com/beef331/micros/blob/master/src/micros/introspection.nim it'd be relatively simple to allow different arity and return types
21:18:14FromDiscord<Elegantbeef> `Table[tuple[paramTypeInfo: pointer, returnTypeInfo: pointer], pointer)` for instance
21:19:57*junaid_ quit (Remote host closed the connection)
21:23:22FromDiscord<Robyn [She/Her]> I like your funny words, magic man
21:24:05FromDiscord<Robyn [She/Her]> I remember we talked about arity but forgot it's meaning
21:24:44FromDiscord<Elegantbeef> Procedure argument count
21:34:36*azimut quit (Remote host closed the connection)
21:34:51FromDiscord<victormihalache> sent a code paste, see https://play.nim-lang.org/#pasty=IcFaaRXXlemX
21:37:30*azimut joined #nim
21:39:30FromDiscord<Robyn [She/Her]> Ah yeah it has to be the same
21:41:21FromDiscord<victormihalache> sent a code paste, see https://play.nim-lang.org/#pasty=tjCQygMMEMBG
21:41:54FromDiscord<Elegantbeef> did you do `-d:release`?
21:42:01FromDiscord<victormihalache> fair, i didn't
21:42:25FromDiscord<Elegantbeef> It'll make it much faster, might also want `-d:lto`
21:42:49FromDiscord<victormihalache> oh boy
21:43:04FromDiscord<victormihalache> shreas rust lol https://media.discordapp.net/attachments/371759389889003532/1205992354604122202/Screenshot_2024-02-10_at_22.42.55.png?ex=65da62e7&is=65c7ede7&hm=de1965560b3d5f69f1e2097cf372779f6a56666a0e09dc1a15849607386a4dfe&
21:43:08FromDiscord<victormihalache> (edit) "shreas" => "shreads"
21:43:17FromDiscord<Elegantbeef> Is your rust in release?
21:43:52FromDiscord<victormihalache> i'm also guessing not
21:44:10FromDiscord<victormihalache> brb
21:44:12FromDiscord<Elegantbeef> Welcome to compiled languages
21:44:35FromDiscord<Elegantbeef> Almost all compiled languages default to debug cause it's faster to compile and provides diagnostics
21:44:51FromDiscord<victormihalache> i havent coded in one in months, kinda forgot about all this haha
21:45:35FromDiscord<Elegantbeef> Also httpbeast is written in older style nim and I think is written for a specific use case, but i dont recall correctly about the latter point
21:48:16FromDiscord<victormihalache> compiling rust with release beats httpbeast :C↵↵the reason i like httpbeast is due to its sheer simplicity, it's basicaly like a c socket server, just with a python-like syntax. is there some other nim alternative to httpbeast that is performant, yet has a easy-enough-to-understand codebase?
21:48:50FromDiscord<victormihalache> in case anyone's curious (nim in prod release) https://media.discordapp.net/attachments/371759389889003532/1205993808488177675/Screenshot_2024-02-10_at_22.48.33.png?ex=65da6442&is=65c7ef42&hm=77c4d7b31587556438f60c93e50e661de4a706f9159a56539813114daa6e6a55&
21:49:45FromDiscord<Elegantbeef> I don't do web related stuff so I'm just echoing what I've heard
21:52:21FromDiscord<victormihalache> alr, ty tho
22:00:32FromDiscord<luteva> sent a code paste, see https://play.nim-lang.org/#pasty=sauJSBQaddZc
22:01:44FromDiscord<luteva> sent a code paste, see https://play.nim-lang.org/#pasty=VNnVetqzhiOn
22:03:08FromDiscord<Elegantbeef> Damn matrix dropped the first half, but `A | B | C` is not a runtime union, but a generic constraint
22:03:39FromDiscord<Elegantbeef> Use a hand written object variant or https://github.com/alaviss/union
22:04:36FromDiscord<luteva> In reply to @Elegantbeef "Damn matrix dropped the": thx! I'll gonna read that 🙂
22:08:13*jmdaemon joined #nim
22:33:39FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=TdqAUmPoqKKX
22:34:00*nomn quit (Quit: WeeChat 4.1.1)
22:34:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=dUWNcOosdBjK
22:35:14FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#pasty=UBlIHuMnzEYd
22:47:53FromDiscord<user2m> what is the default gc in nim 2.0?
22:48:23FromDiscord<Elegantbeef> orc
22:48:59FromDiscord<user2m> ok great so I don't have to use `--mm:orc`?
23:00:34*advesperacit quit ()
23:11:18NimEventerNew thread by seekworser: Recursive functions returns different values, see https://forum.nim-lang.org/t/10974
23:19:23*disso-peach joined #nim
23:55:00*PMunch quit (Quit: leaving)