<< 15-02-2024 >>

00:00:28FromDiscord<girvo> Oh yep, it was as simple as adding `quit(O)` to my SIGTERM handler
00:04:07FromDiscord<girvo> Wonder if `nim-taskpools` will work with chronos well enough?
00:04:08FromDiscord<leorize> beef\: pick a lib I maintain and copy the CI setup from it
00:04:14FromDiscord<leorize> usually it's a full package with docs
00:04:32FromDiscord<Elegantbeef> Oh right my reason for failing in my exceptions test leaking is likely Nim arc injection being silly about exceptionful code
00:04:59FromDiscord<Elegantbeef> I looked at it leo but got lost in the yaml and went "uh huh"
00:05:26FromDiscord<leorize> apparently according to dis he just copy them and they work, but ymmv
00:06:21FromDiscord<Elegantbeef> Well I was going to remove the skull part as it's not testable presently
00:06:51FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#pasty=jYmXBctsRYVP
00:07:18FromDiscord<Elegantbeef> `--nimMainPrefix` should apply to nim proc gen
00:07:37FromDiscord<that_dude.> But I'm using that and I'm still getting issues
00:07:54FromDiscord<Elegantbeef> Nim -v?
00:08:03FromDiscord<that_dude.> 2.1.1
00:08:14FromDiscord<that_dude.> Latest devel afaik
00:08:57FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#pasty=PLKsuFeSPwII
00:09:17FromDiscord<Robyn [She/Her]> In reply to @leorize "beef\: pick a lib": Or use mine, I've also made mine fairly alright :P
00:10:47FromDiscord<Robyn [She/Her]> Actually yours is probably bettwr
00:10:49FromDiscord<Robyn [She/Her]> Oh well
00:13:24FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/issues/19830 seems it broke again
00:16:22*jmdaemon joined #nim
00:33:06FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=TsOeVAsTVkBb
00:33:09FromDiscord<girvo> Well poop
00:43:25FromDiscord<Elegantbeef> Get with the times old man
00:45:41FromDiscord<girvo> we _cannnn't_ not yet anyway
00:45:50FromDiscord<Elegantbeef> Not with that attiude
00:45:52FromDiscord<girvo> (we have a v2 branch but there shit we need to solve first)
00:46:10FromDiscord<girvo> Man nimsuggest chk with the nimsaem VSCode extension has lost the plot lately
00:46:45FromDiscord<girvo> sent a code paste, see https://play.nim-lang.org/#pasty=UOtqsAueSJFF
00:47:05FromDiscord<Robyn [She/Her]> In reply to @girvo "(we have a v2": Yeaaah, switch to the one in the Nim org
00:47:37FromDiscord<Robyn [She/Her]> Download the vsx and then drag it onto the extensions tab in VSC and it'll install (probably an easier way to do it)
00:47:43FromDiscord<girvo> Okay sweet 🙂
00:47:46FromDiscord<girvo> Thanks!
00:48:00FromDiscord<girvo> (theres a `code` commandline thing you can run to install a vsx)
00:48:05FromDiscord<Robyn [She/Her]> Of course! I did this a few days ago aha, it definitely seems nicer than the Nim saem one
00:48:10FromDiscord<Elegantbeef> Though that'll be running a newer nimlang server that might have an issue with older code
00:48:15FromDiscord<Robyn [She/Her]> In reply to @girvo "(theres a `code` commandline": Oh? Is there?
00:48:24FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Though that'll be running": Ah true
00:49:11FromDiscord<girvo> In reply to @Elegantbeef "Though that'll be running": hm good point
00:49:12FromDiscord<girvo> I'll try anyway
00:51:18FromDiscord<girvo> Seems okay so far
00:51:54FromDiscord<girvo> It's using nimsuggest it seems, but isn't yelling about correct code anymore
00:52:18FromDiscord<girvo> Oh yay! outline and ctrl-shift-o now works properly
00:59:53FromDiscord<girvo> is there a `{.deprecated.}` pragma or similar approach that will let me annotate it? Or just `{.deprecated.}` with a `# comment` ?
01:00:09FromDiscord<girvo> `{.deprecated: "3011 and below".}` is what I'd love to do lol
01:02:59FromDiscord<Elegantbeef> There is a deprecated
01:08:17FromDiscord<girvo> yes but it doesn't let me annotate it 😛
01:08:23FromDiscord<Elegantbeef> What?
01:08:31FromDiscord<girvo> FourToTwenty = object↵ a: Option[FourToTwentyData]↵ b: Option[FourToTwentyData]↵ inputVoltage {.deprecated: "3011 and below".}: Option[InputVoltage]
01:08:33FromDiscord<girvo> I wanna do this
01:08:39FromDiscord<Elegantbeef> `proc doStuff {.deprecated: "Jump in a river".}`
01:08:51FromDiscord<girvo> I guess its just nimsuggest whinging then?
01:09:13FromDiscord<girvo> It says "annotation to deprecated not supported here"
01:09:27FromDiscord<Elegantbeef> I never got you wanted to deprecate a field
01:09:34FromDiscord<Elegantbeef> It's a bit odd to want to do but yea there is no way to deprecate it
01:09:41FromDiscord<Elegantbeef> Well there is one way
01:10:32FromDiscord<Elegantbeef> It involves doing `inputVoltageBacker: ...`, `proc inputVoltage=(val: var FourToTwenty, val: ...) {.deprecated.} = ...` and a getter
01:17:35*om3ga quit (Read error: Connection reset by peer)
01:21:32*om3ga joined #nim
01:42:25*tc424 quit (Ping timeout: 264 seconds)
01:52:53*tc424 joined #nim
02:04:41FromDiscord<bosinski2023> In reply to @Elegantbeef "It involves doing `inputVoltageBacker:": hi, i think we should deprecate single-threaded LRU-Caches and instead use a obstruction-free RLU-Cache like the one i put into the #test - channel 🙂
02:05:34FromDiscord<Elegantbeef> This is in response to?
02:06:09FromDiscord<bosinski2023> In reply to @Elegantbeef "This is in response": not really..
02:06:16*xet7 quit (Remote host closed the connection)
02:07:27FromDiscord<bosinski2023> (edit) "In reply to @Elegantbeef "This is in response": not really.. ... " added "but take a loooḱ, its from one of those amazing science-papers, i'm working on it"
02:07:40FromDiscord<bosinski2023> (edit) "loooḱ," => "look,"
02:13:21FromDiscord<that_dude.> Hey Elegant, I tried some of the cli options as mentioned in that issue, but none fixed my issue. What should I do? Just build a test case and then open a bug report?
02:17:32FromDiscord<privsec> wahh
02:17:41FromDiscord<privsec> hi again
02:29:40FromDiscord<Elegantbeef> @that_dude. yea seems Nim has no mechanism for multiple static libs with the same procs being called
02:29:54FromDiscord<Elegantbeef> Though to be fair you'd probably want to share procs across shared libs 9/10 times
02:30:09FromDiscord<Elegantbeef> `$10` should only have a single `$` in the end I'd argue
02:32:01*xet7 joined #nim
02:39:41FromDiscord<that_dude.> I'll take what I have and see if I can throw together a bug report for that then. Changing to lib didn't seem to have an effect either, but I'm still trying to mess with the things
02:55:58FromDiscord<Elegantbeef> The objcopy solution deech mentioned is probably the easiest to use presently
03:02:17FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#pasty=zzvFvDruFDCP
03:02:56FromDiscord<that_dude.> It'll have to do, I just need to clean up any old main stuff since there's one main now
03:25:32*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
03:28:06FromDiscord<that_dude.> Is there something that makes `NimMain()` not show up? I had it working before when I was using the prefix option, but now without it, I can't seem to use it from a sub file
03:28:56FromDiscord<Elegantbeef> It will always be there unless you give it a prefix
03:29:09FromDiscord<that_dude.> :/
03:29:11*Lord_Nightmare joined #nim
03:32:48FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#pasty=YWORcAxtvUcJ
03:32:59FromDiscord<that_dude.> sent a code paste, see https://play.nim-lang.org/#pasty=msHzlZtWrZwm
03:33:10FromDiscord<that_dude.> (edit) "https://play.nim-lang.org/#pasty=SgwiIrcVePrZ" => "https://play.nim-lang.org/#pasty=fGTzAnprbFRp"
03:33:20FromDiscord<that_dude.> I don't think I'm doing anything weird
03:33:54FromDiscord<that_dude.> Fuck
03:34:02FromDiscord<that_dude.> Forgot it was include I wanted not import
03:34:09FromDiscord<that_dude.> Ignore this
03:44:00*redj joined #nim
03:45:35FromDiscord<Elegantbeef> Should likely wrap that in a `once:` 😄
03:47:30FromDiscord<that_dude.> Didn't know that was a thing
03:47:41FromDiscord<that_dude.> Can do
04:59:53FromDiscord<girvo> Hm, we're now running out of buffer space in LwIP when they connect to the Chronos server. Odd. The firmware code hasn't changed. ↵↵It's literally dying in the let socket = newSocket() call. Wild
05:10:32FromDiscord<girvo> Silly question, but what `--gc:` should we be using with `chronos`? its not in their docs
05:10:56FromDiscord<Elegantbeef> It should work with arc since it's cycle free
05:11:01FromDiscord<Elegantbeef> So 'any'
05:11:35FromDiscord<Elegantbeef> Status still uses refc afaik though
05:12:19FromDiscord<girvo> I compiled with `arc` and it seems to have a cycle in 4.0.0?
05:12:37FromDiscord<girvo> `/root/.nimble/pkgs/chronos-#head/chronos/internal/asyncfutures.nim(1197, 6) Warning: ':env.cb3 = (:anonymous, :env)' creates an uncollectable ref cycle; annotate 'cb3' with .cursor [CycleCreated]`
05:13:45FromDiscord<girvo> actually I somehow ended up on #head there...
05:14:02FromDiscord<girvo> Though 4.0.0 has the same compile warning
05:15:38FromDiscord<girvo> I'll switch the server back to refc for the moment
05:18:15FromDiscord<girvo> Whats the issue with `orc` and threads?
05:18:47FromDiscord<Elegantbeef> The cycle collector is not thread aware
05:19:08FromDiscord<Elegantbeef> So having cyclical graphs shared across threads just explodes
05:22:11FromDiscord<girvo> Yeah fair enough
05:40:47FromDiscord<leorize> chronos does have cycles
05:40:47FromDiscord<leorize> just ask phil
05:40:47FromDiscord<Elegantbeef> They played us for fools
05:47:59FromDiscord<leorize> you don't need cycles
05:48:14FromDiscord<leorize> just having refs is enough to make orc go boom with threads
05:48:32FromDiscord<girvo> Now we suddenly have a segfault in our server too
05:48:48FromDiscord<girvo> Which wasn't there earlier today, with the same client devices communicating with it. Wild
05:49:20FromDiscord<leorize> if you didn't give it the thread sanitizer treatment, how can you be sure it's ever safe?
05:49:37FromDiscord<nnsee> fuck around and find out
05:52:20*rockcavera quit (Remote host closed the connection)
05:57:41FromDiscord<leorize> the thing with threads is that it's broken unless proven otherwise
06:45:52*mal`` quit (Quit: Leaving)
06:55:46*advesperacit joined #nim
07:05:54*PMunch joined #nim
07:06:34*mal`` joined #nim
07:49:51*advesperacit quit ()
07:52:15*advesperacit joined #nim
08:14:42*azimut joined #nim
08:23:13*azimut quit (Remote host closed the connection)
08:23:34*azimut joined #nim
08:38:20NimEventerNew thread by ingo: Create ungraceful exit program, see https://forum.nim-lang.org/t/10999
08:54:26NimEventerNew thread by ggibson: How to use Weave isReady?, see https://forum.nim-lang.org/t/11000
08:57:52*om3ga quit (Read error: Connection reset by peer)
09:00:35*om3ga joined #nim
09:24:20*PMunch quit (Quit: Leaving)
10:58:35FromDiscord<Robyn [She/Her]> To avoid mem leaks from cyclic references, does explicitly setting a ref object to nil make arc able to collect it?
11:03:12FromDiscord<odexine> I believe breaking cycles does allow arc to work
11:17:36*ntat joined #nim
11:23:59*Jjp137 quit (Ping timeout: 260 seconds)
11:24:19*Jjp137 joined #nim
11:26:07FromDiscord<grumblygibson> sent a code paste, see https://play.nim-lang.org/#pasty=HQXmTYGevYBN
11:26:14FromDiscord<grumblygibson> (edit) "https://play.nim-lang.org/#pasty=DzLfWCUgWDjt" => "https://play.nim-lang.org/#pasty=kTjNflYHWOsH"
11:35:59*derpydoo quit (Ping timeout: 264 seconds)
11:40:37FromDiscord<demotomohiro> 'move' doesn't means move object itself to other object. 'move' usually used for objects that contains a pointer to internal heap, and copy the pointer to other object.
11:44:32FromDiscord<demotomohiro> In reply to @grumblygibson "`seq` question: Why moving": So you need to compare the content of `Column`, not an address of `Column` itself to see if it is moved.
11:46:59*jmdaemon quit (Ping timeout: 252 seconds)
12:02:25FromDiscord<Robyn [She/Her]> In reply to @odexine "I believe breaking cycles": Sweet
12:02:34FromDiscord<Robyn [She/Her]> Now I need to figure out how selectors work...
12:16:42FromDiscord<crufty.> Hi new here. Why is it when I run the following command 'nimble search lean' I get 'Error No package found.' Does this package not exist?
12:17:54FromDiscord<crufty.> Same with sequtils and time.
12:21:27FromDiscord<odexine> None of those modules need to be installed, they are bundled
12:21:39FromDiscord<odexine> Because they are part of the standard library
12:21:47FromDiscord<crufty.> Ah! OK this makes sense, thank you
12:22:50FromDiscord<crufty.> I started this search because I'm getting the error Error: cannot open file: time, which is also bundled I suppose because not present in a nimble search
12:25:04FromDiscord<nnsee> the module in the stdlib is called `times`
12:26:10FromDiscord<crufty.> Oh my... The S
12:26:13FromDiscord<crufty.> Thank you
12:28:57FromDiscord<Robyn [She/Her]> In reply to @nnsee "the module in the": Hey Ras, have you worked with selectors, by any chance? :p
12:29:09FromDiscord<Robyn [She/Her]> I'm struggling to figure out how I should use them in general atm
12:34:58FromDiscord<nnsee> can't say that i have tbh
12:35:59FromDiscord<Robyn [She/Her]> 😭 oh well
12:36:11FromDiscord<Robyn [She/Her]> https://gist.github.com/dom96/3b1c21dcc2598aae5961 I have found this at least
12:36:27FromDiscord<Robyn [She/Her]> Assuming `Data` is something I want to be passed around?
12:46:31*PMunch joined #nim
12:48:25*derpydoo joined #nim
13:01:47*nazgulsenpai quit (Ping timeout: 264 seconds)
13:05:20*gooba quit (Remote host closed the connection)
13:38:44FromDiscord<odexine> i kind of hve, what do you need help with?
13:41:40FromDiscord<odexine> In reply to @chronos.vitaqua "I'm struggling to figure": basically selectors are a way to ask the operating system if i can do something with a file descriptor
13:45:21*rockcavera joined #nim
13:45:30FromDiscord<Robyn [She/Her]> In reply to @odexine "basically selectors are a": Okay I think I kinda understand that
13:45:36FromDiscord<Robyn [She/Her]> Gonna try implementing something
13:46:00FromDiscord<Robyn [She/Her]> Just kinda lost on if I need to do anything special for accepting connections... Assuming that also needs to be in a selector
13:46:02FromDiscord<Robyn [She/Her]> ?
13:57:13FromDiscord<odexine> if its a file descriptor, it can be done
13:58:04FromDiscord<demotomohiro> I heard that epoll is newer and better than selectors. And Nim's stdlib use it: https://github.com/nim-lang/Nim/blob/devel/lib/pure/ioselects/ioselectors_epoll.nim
13:58:55FromDiscord<odexine> selectors uses epoll no?
14:00:12FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=ivcKDgMcosYg
14:00:41FromDiscord<odexine> you might be mistaking "selectors" with "poll"
14:02:58advesperaciteasy mistake since there is select() as well as poll()
14:04:28FromDiscord<demotomohiro> In reply to @odexine "https://nim-lang.org/docs/selectors.html `Supported": I misunderstand that you were talking about `select` C function.
14:47:57FromDiscord<grumblygibson> In reply to @demotomohiro "So you need to": yes I also compared the address of a field inside column, and it was different.
15:15:03FromDiscord<demotomohiro> In reply to @grumblygibson "yes I also compared": Content of `Column.data` is moved in this example code:↵https://play.nim-lang.org/#pasty=SvWHKNnSIPba
15:18:42*ntat quit (Quit: Leaving)
15:19:32FromDiscord<grumblygibson> And if data is not a seq, like an int? Then the addresses appear different. I actually was thinking that move implied that a new allocation would be avoided.
15:22:59FromDiscord<odexine> allocation of what? no heap allocations are done in the case you provide
15:28:00*PMunch quit (Quit: Leaving)
15:37:20*The_Buhs left #nim (The Lounge - https://thelounge.chat)
16:25:50*ntat joined #nim
16:32:10*xet7 quit (Remote host closed the connection)
16:47:23*jmdaemon joined #nim
16:48:28*baalajimaestro joined #nim
17:16:28*krux02 quit (Remote host closed the connection)
17:24:36FromDiscord<Robyn [She/Her]> This is so weird
17:24:55FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=ZpDEmBFmwEHU
17:25:01FromDiscord<Robyn [She/Her]> (edit) "https://play.nim-lang.org/#pasty=FACwTHPgOwwV" => "https://play.nim-lang.org/#pasty=UxgxRZlYnFcP"
17:26:08*jmdaemon quit (Ping timeout: 268 seconds)
17:26:21FromDiscord<Robyn [She/Her]> Ah
17:26:30FromDiscord<Robyn [She/Her]> Malebolgia's release is broken, that's why
17:26:33FromDiscord<Robyn [She/Her]> Painful
18:06:14*krux02 joined #nim
18:14:08FromDiscord<Robyn [She/Her]> When using selectors, is it better to discard the original `Socket` object and use the underlying file descriptor or...
18:15:10*nazgulsenpai joined #nim
18:24:52*cnx quit (Ping timeout: 246 seconds)
18:29:01FromDiscord<Robyn [She/Her]> Aaagh my enum can't just be the packet IDs, I'm gonna need a table for enum to packet IDs :/
18:29:16FromDiscord<Robyn [She/Her]> Since some data uses the same packet ID for the same thing
18:32:13*cnx joined #nim
18:33:46*xet7 joined #nim
18:33:49FromDiscord<Robyn [She/Her]> Wait nvm not an issue
18:33:54FromDiscord<Robyn [She/Her]> This is a server not a client
18:34:57FromDiscord<Robyn [She/Her]> I do need to make a template to create constructor procs to automatically set the kind of an object tho
18:37:02FromDiscord<Robyn [She/Her]> Is there a way to get all objects that inherit from a specific object in Nim?
18:37:09FromDiscord<Robyn [She/Her]> (edit) "Nim?" => "a Nim macro?"
18:37:16FromDiscord<leorize> no
18:41:27FromDiscord<griffith1deadly> In reply to @chronos.vitaqua "Since some data uses": yep
18:41:52FromDiscord<griffith1deadly> with diffirent states packet ids can be same
18:47:01*PMunch joined #nim
19:03:57advesperacitwhen using futhark on dynamic library, do I have find all dependent header files and put them in one file hierarchy?
19:04:33advesperacitor can I get it to just do it for me like compiler would using `pkg-config --cflags --libs ...`
19:06:25PMunchadvesperacit, you can leave everything where it is
19:06:37PMunchpkg-config works great
19:07:25PMunchHere's an example of my Gtk wrapper using Futhark: https://pasty.ee/xAqdVohjBxki
19:07:29PMunch@advesperacit *
19:08:10advesperacitah, so you put it like that
19:08:18advesperacitthank you, that'll save me a ton of trouble
19:08:40PMunchNotice that I use pkg-config twice in that file
19:12:34advesperacitDo I copy you and reference the my libs in both but --libs on passL and --cflags on the compilerarg?
19:13:15PMunchPretty much
19:13:47advesperacitGreat, it'll be much easier with your example to work from
19:20:30advesperacit"Error: interpretation requires too many iterations" is this a problem or should I just increase iterations?
19:22:29advesperacitAh, works with 50000000
19:22:53PMunchYeah that's a problem with the json parser..
19:41:59FromDiscord<Robyn [She/Her]> In reply to @leorize "no": Unfortunate
19:44:58FromDiscord<Robyn [She/Her]> You can't modify `lent` types, can you?
19:46:06FromDiscord<Robyn [She/Her]> > This is useful for "getter" accessors that seek to allow an immutable view into a container.↵So assuming that's what it means
19:47:18advesperacit@PMunch I got my little code working with suprisingly little effort thanks to futhark
19:47:54advesperacitexcellent software
19:49:02PMunchThank you :)
19:49:12PMunchIt really is marvelous once you figure out how to use it
20:01:33NimEventerNew Nimble package! statsdaemon - StatsD compatible daemon in pure Nim, see https://github.com/Q-Master/statsdaemon.nim
20:02:36FromDiscord<Robyn [She/Her]> is Malebolgia known to not play well with references or something?
20:03:50PMunchNot particularly
20:05:35FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=gFqKANttdAWE
20:05:40FromDiscord<Robyn [She/Her]> A tad long
20:09:24FromDiscord<Robyn [She/Her]> Figured it out
20:09:30FromDiscord<Robyn [She/Her]> My editor is lying to me
20:24:27FromDiscord<Robyn [She/Her]> sent a long message, see https://pasty.ee/QwEhyUEClfll
20:24:42FromDiscord<Robyn [She/Her]> Is it because I'm trying to pass a sequence? Would make sense
20:24:48FromDiscord<Robyn [She/Her]> But do strings work...
20:25:07FromDiscord<Robyn [She/Her]> That's a no?
20:27:07FromDiscord<Robyn [She/Her]> leorize: Hey, do you know why I can't push strings onto a Loony queue?
20:27:24FromDiscord<leorize> you can only push refs/ptrs
20:28:21FromDiscord<Robyn [She/Her]> Thanks aha, confused me
20:30:31FromDiscord<Robyn [She/Her]> Hm... Should I push a buffer type (which is a ref obj) or a ptr seq[byte]
20:32:33FromDiscord<leorize> anything you want really
20:32:37*lx12ucy joined #nim
20:42:10FromDiscord<michaelap> Well, I just completed the Nim track on Exercism. https://media.discordapp.net/attachments/371759389889003532/1207788967026491412/20240215_14h24m00s_grim.png?ex=65e0ec21&is=65ce7721&hm=a27ec25903d409c5e0f86b6a7dd9c3102700c9aaadcca071151edd127e7fdab1&
20:43:08FromDiscord<Elegantbeef> Congrats you're an expert now
20:43:14*lx12ucy quit (Ping timeout: 252 seconds)
20:44:43FromDiscord<michaelap> Haha, certainly not even close. An ignoramus with a checkmark.
20:44:57*lx12ucy joined #nim
20:44:59FromDiscord<Elegantbeef> Join the club
20:54:25*lx12ucy quit (Ping timeout: 264 seconds)
20:57:36*lx12ucy joined #nim
21:00:22FromDiscord<Robyn [She/Her]> In reply to @leorize "anything you want really": Assuming no downside to either?
21:00:37FromDiscord<Robyn [She/Her]> I'll stick with a plain `ptr seq[byte]` then
21:09:44FromDiscord<Robyn [She/Her]> Does loony's `pop` return nil if there's nothing in the queue?
21:10:11FromDiscord<Robyn [She/Her]> Seems like a yes
21:20:51*lx12ucy quit (Ping timeout: 260 seconds)
21:21:34*ntat quit (Quit: Leaving)
21:22:27*lx12ucy joined #nim
21:24:38FromDiscord<Robyn [She/Her]> Selectors seem to bug out the Nim plugin for some reason
21:24:59FromDiscord<Robyn [She/Her]> Errors pop up on selector-related that aren't showing in compilation
21:27:33*lx12ucy quit (Ping timeout: 268 seconds)
21:31:06NimEventerNew thread by iffy1: IOS EXC_BAD_ACCESS nimZeroMem, see https://forum.nim-lang.org/t/11012
21:51:08FromDiscord<Robyn [She/Her]> Hey leorize, why aren't the socket types exported in https://github.com/alaviss/nim-sys/blob/master/src/sys/sockets.nim ?
21:51:16FromDiscord<Robyn [She/Her]> Seems like an oversight :p
21:51:38FromDiscord<leorize> you aren't supposed to use them was the idea \:p
21:51:52FromDiscord<Robyn [She/Her]> But why?
21:52:29FromDiscord<Robyn [She/Her]> I'm storing a socket in a `Connection` object so I need to be able to use the types
21:52:34FromDiscord<leorize> because you should be using `Listener` or `Conn`
21:52:46FromDiscord<myu_msn_was_better_tbh> Good day ! I am new to Nim. Any idea why I got this ? /Users/myu/.choosenim/toolchains/nim-2.0.2/lib/pure/nativesockets.nim(570, 7) Error: undeclared identifier: 'copyMem'
21:52:47FromDiscord<Robyn [She/Her]> Wait ah
21:53:23FromDiscord<leorize> well even if those were exported you wouldn't be able to do much with them anyway
21:53:57FromDiscord<leorize> the library declares almost nothing for them
21:55:08FromDiscord<Robyn [She/Her]> Yeah fair enough
21:55:25FromDiscord<Robyn [She/Her]> I didn't read the docs and I started reading source code :p
21:56:23FromDiscord<leorize> the source code isn't that bad but you should probably read the docs
21:56:40FromDiscord<Robyn [She/Her]> Probably yeah, I'll do that now
21:57:48FromDiscord<Robyn [She/Her]> Agh the distinction between a listener and a connection is useful but annoying here
21:58:26FromDiscord<Robyn [She/Her]> Before I was able to mess with selectors by passing `nil` and just using the socket I had available in the scope for the server
21:58:27FromDiscord<leorize> why is that?
21:59:57FromDiscord<leorize> what does that even mean?
22:00:18FromDiscord<Robyn [She/Her]> I'll show my code real quick
22:02:12FromDiscord<Robyn [She/Her]> Oh, by 'mess with selectors' I meant I could pass `nil` instead of my custom connection object so I knew I was using the server socket
22:03:13*PMunch quit (Quit: Leaving)
22:03:57FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=fdcGzWGMSrwi
22:04:18FromDiscord<leorize> ah you're using selectors
22:04:25*KhazAkar quit (Ping timeout: 260 seconds)
22:04:55FromDiscord<leorize> nim-sys is all in on the cps ecosystem, so you should be using ioqueue
22:05:23FromDiscord<leorize> not that it won't work, though
22:05:34FromDiscord<leorize> since you can still pass `nil` if you really wanted to
22:05:56*KhazAkar joined #nim
22:05:57FromDiscord<leorize> just `Conn[TCP](nil)` since it's still a ref
22:07:03FromDiscord<Robyn [She/Her]> Fair
22:08:31FromDiscord<Robyn [She/Her]> Looking at `ioqueue` is leaving me a little confused
22:08:56FromDiscord<Robyn [She/Her]> I'm guessing I need to use cps together with this to actually use it correctly?
22:10:29FromDiscord<Robyn [She/Her]> Looking into that now
22:11:10FromDiscord<leorize> so the only thing you need to do with ioqueue
22:11:30FromDiscord<leorize> is to tag your function with `{.asyncio.}`
22:11:56FromDiscord<leorize> and then write the code as if it's blocking
22:12:30FromDiscord<Robyn [She/Her]> Oh
22:12:30FromDiscord<leorize> I would be able to give you more details if you tell me exactly what you're doing and what is your thread structure
22:15:42FromDiscord<Elegantbeef> How are you compiling?↵(@myu_msn_was_better_tbh)
22:17:41FromDiscord<myu_msn_was_better_tbh> With nim c filename.nim on macOS arm64. The nim compiler is x64 though
22:17:58FromDiscord<Robyn [She/Her]> In reply to @leorize "I would be able": I struggle with explaining stuff, a lot-↵↵By thread structure do you mean what tasks am I going to be doing on a thread specifically or?
22:19:32FromDiscord<leorize> yea
22:20:50FromDiscord<Robyn [She/Her]> Alright so I wanna put all of my network related code onto a single thread... That's really it tbh↵I have many clients connecting to a single TCP server
22:21:17*lx12ucy joined #nim
22:22:21*lx12ucy quit (Client Quit)
22:22:40*lx12ucy joined #nim
22:23:46*lx12ucy quit (Client Quit)
22:24:05*lx12ucy joined #nim
22:26:09FromDiscord<Elegantbeef> Never seen this issue before myu, i'd suggest building the compiler from source to get an arm compiler
22:27:19FromDiscord<myu_msn_was_better_tbh> In reply to @Elegantbeef "Never seen this issue": Alright, makes sense ! Thank you 🙂
22:29:54FromDiscord<leorize> that's easy enough↵(@Robyn [She/Her])
22:30:26FromDiscord<leorize> I'll rewrite this one for you, one sec↵(@Robyn [She/Her])
22:31:00FromDiscord<Robyn [She/Her]> Alright! Thanks aha, I appreciate it
22:31:48FromDiscord<leorize> well your send stuff is weird
22:31:53FromDiscord<Elegantbeef> Robyn is secretly playing the ignorant just to get people to write their code 😄
22:33:33FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "*Robyn is secretly playing": That doesn't happen usually tho
22:33:42FromDiscord<Robyn [She/Her]> In reply to @leorize "well your send stuff": Oh? Why?
22:34:48FromDiscord<leorize> because you're spinning on the write ready state
22:35:04FromDiscord<leorize> and then you just do nothing becausse you have no packets
22:35:36FromDiscord<Robyn [She/Her]> Wdym by spinning?
22:35:49FromDiscord<Robyn [She/Her]> In reply to @leorize "and then you just": `processClient` has more code hold on
22:36:04FromDiscord<horsefucking> how do i escape ' from a type?
22:36:46FromDiscord<Robyn [She/Her]> https://play.nim-lang.org/#pasty=IYBbRqQEtemQ
22:37:09FromDiscord<Elegantbeef> Escape what from a type?
22:38:27FromDiscord<horsefucking> sent a code paste, see https://play.nim-lang.org/#pasty=EnQEPIiEhnxu
22:38:42FromDiscord<Elegantbeef> I mean stop it get some help 😄
22:39:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=nFBXauOceclr
22:39:31FromDiscord<Elegantbeef> Not that I see why the hell you're doing this
22:39:58FromDiscord<soup> i am importing a javascript module which uses " in one of its objects and it doenst work
22:40:26FromDiscord<Elegantbeef> `importjs` or `importc` is your friend
22:40:27FromDiscord<soup> someObject["m.relates\_to"]
22:40:56Amun-Raeven importcpp
22:41:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=MrdCtUVkVmic
22:51:05*lx12ucy quit (Quit: WeeChat 4.2.1)
22:51:24*lx12ucy joined #nim
22:59:01*advesperacit quit ()
23:10:08FromDiscord<leorize> that's some extra juice to handle \:p↵(@Robyn [She/Her])
23:12:05FromDiscord<Robyn [She/Her]> :P
23:12:31FromDiscord<Robyn [She/Her]> Ya don't have to rewrite it for me, I just need to understand what I need to change exactly-
23:13:20FromDiscord<leorize> how are your event handler done?
23:13:24FromDiscord<leorize> are they like same thread or what?
23:15:35FromDiscord<Robyn [She/Her]> Yeah it's on the same thread
23:16:04FromDiscord<Robyn [She/Her]> The code for the event handler is at https://github.com/Nimberite-Development/Pulse-Nim if you need something more descriptive than my shoddy explanation-
23:18:36FromDiscord<leorize> lol the queue is practically useless if you use it with nim-sys
23:19:27FromDiscord<Robyn [She/Her]> Oh? Why?
23:20:16FromDiscord<Robyn [She/Her]> I'll likely be adding to the queue from another thread so that's why i wanna use a queue
23:23:12FromDiscord<leorize> you'll want a kind of blocking queue for that
23:23:22FromDiscord<leorize> there's loony ward but I haven't tested it
23:23:27FromDiscord<Robyn [She/Her]> AH
23:23:29FromDiscord<Robyn [She/Her]> Ah
23:23:38FromDiscord<Robyn [She/Her]> Good reason to start testing it, I guess? :P
23:24:26FromDiscord<leorize> I don't have a good way to replicate your send code
23:24:33FromDiscord<leorize> in fact I'd be surprised if it runs at all
23:24:41FromDiscord<leorize> since it will be perpetually stuck at that send
23:24:59FromDiscord<Robyn [She/Her]> Oh, I can push the entire code to GitHub if you really want? It's already in a repo but not up-to-date
23:25:13FromDiscord<Robyn [She/Her]> It'd probably be easier if I just modified it and you said "do X and Y" :p
23:25:17FromDiscord<leorize> don't worry about it, I'll just let you figure out how to do the send properly \:p
23:25:32FromDiscord<Robyn [She/Her]> Alright!
23:25:40FromDiscord<Robyn [She/Her]> In reply to @leorize "since it will be": Wait why
23:26:08FromDiscord<Robyn [She/Her]> If I'm popping from the queue why is that an issue?
23:27:04FromDiscord<leorize> it's not that you are popping from the queue
23:27:23FromDiscord<leorize> it's the fact that you will always be ready to `Write`
23:27:31FromDiscord<leorize> as such that path will always be triggered
23:27:47FromDiscord<leorize> and you will spin on that branch
23:28:37FromDiscord<Robyn [She/Her]> Ah... Not sure how to fix that then, unless I always assume that writing is allowed, I thought there were cases where it may not be possible?
23:29:33FromDiscord<leorize> yep, but if you haven't written a single byte then ofc it's possible
23:30:20FromDiscord<leorize> https://play.nim-lang.org/#pasty=KLTEQZbMPClG
23:31:04FromDiscord<Robyn [She/Her]> trampoline? Welp?
23:31:29FromDiscord<Robyn [She/Her]> Assuming I need to import ioqueue and cps?
23:31:35FromDiscord<Robyn [She/Her]> (edit) "Welp?" => "Whelp?"
23:31:38FromDiscord<leorize> yea
23:31:48FromDiscord<leorize> so `whelp` creates a continuation
23:32:01FromDiscord<leorize> and `trampoline` would run the continuation until it's queued
23:32:10FromDiscord<girvo> delicious cps
23:32:21FromDiscord<Robyn [She/Her]> In reply to @leorize "and `trampoline` would run": Neat
23:32:43FromDiscord<leorize> it's prettier when you actually have an event queue
23:33:16FromDiscord<leorize> since ioqueue only give you the I/O part of a queue
23:33:19FromDiscord<girvo> In reply to @Elegantbeef "*Robyn is secretly playing": Isn't there some Law of the Internet about that
23:33:32FromDiscord<Robyn [She/Her]> Fair, I might look into properly learning cps
23:33:46FromDiscord<girvo> In reply to @chronos.vitaqua "Fair, I might look": do it. continuations are so good
23:33:50FromDiscord<leorize> cps will make your event scheme obsolete \:P
23:34:00FromDiscord<leorize> since you won't be sending events, you will be sending compute
23:34:13FromDiscord<Robyn [She/Her]> And cps works between threads? Or?
23:34:15FromDiscord<girvo> I've not gone deep into cps in _nim_ but I've used them extensively in Scheme and some other langs lol
23:34:37FromDiscord<Robyn [She/Her]> I'll gladly give up Pulse for something better so
23:34:38FromDiscord<leorize> yea, one of the use case was to move compute between threads
23:34:41FromDiscord<leorize> that's what loony was for btw
23:34:43FromDiscord<Robyn [She/Her]> Oh sweet
23:34:48FromDiscord<Robyn [She/Her]> In reply to @leorize "that's what loony was": Figured
23:35:04FromDiscord<Robyn [She/Her]> In reply to @girvo "I've not gone deep": How's it like there? And how does it compare to async?
23:35:35FromDiscord<girvo> It's a lower level abstraction than async, while also being sort of a superset of it. I'm very bad at explaining it
23:35:49FromDiscord<leorize> we spent 3yrs and haven't managed to either \:p
23:35:49FromDiscord<Robyn [She/Her]> Fair
23:35:59FromDiscord<leorize> but if you want something similar, look at kotlin
23:35:59*derpydoo quit (Ping timeout: 256 seconds)
23:36:00FromDiscord<Robyn [She/Her]> In reply to @leorize "we spent 3yrs and": Lol
23:36:05FromDiscord<girvo> like you can build async with cps 😛
23:36:11FromDiscord<Robyn [She/Her]> In reply to @leorize "but if you want": Kotlin has coroutines right?
23:36:12FromDiscord<girvo> but not _just_ async
23:36:42FromDiscord<leorize> yea, coroutines are the closest to cps
23:36:55FromDiscord<Robyn [She/Her]> Neat
23:37:03FromDiscord<girvo> coroutines are also lovely, but not every implementation of them is as powerful as they should be
23:37:08FromDiscord<leorize> though I'd say it's interesting that kotlin has about the same number of restrictions for them as with cps
23:37:20FromDiscord<girvo> luas coros are decent
23:37:23FromDiscord<leorize> despite their coroutines being in the compiler
23:37:35FromDiscord<girvo> In reply to @leorize "despite their coroutines being": oh interesting
23:37:43FromDiscord<girvo> I haven't actually looked deep into kotlin
23:38:17FromDiscord<leorize> for most practical usage they should be identical to nim cps
23:39:04FromDiscord<leorize> they do have a bunch of areas where they are better than our macros-based cps, like being able to integrate with overloading resolution and stuff
23:39:30FromDiscord<girvo> btw I meant to ask, is a continuation cancellable in nim cps? and if its cancelled, does it properly clean up the scope/call destructors the way its supposed to?
23:39:31FromDiscord<leorize> but fundamentally they can do more or less the same stuff that we can do with nim cps
23:39:53FromDiscord<leorize> depends on what kind of cancellation are you looking for
23:40:03FromDiscord<girvo> I still want to see if it'll run well on two thread/Tasks in freertos and let us be able to cancel/unblock & clean up some blocking IO
23:40:05FromDiscord<Robyn [She/Her]> In reply to @leorize "but fundamentally they can": Makes sense, definitely seems super neat honestly
23:40:10FromDiscord<girvo> but I think I need to really plan that out to make the question make more sense
23:40:33FromDiscord<leorize> there's the yeet to the bin type, which requires destructors to clean up (and this is where nim-sys comes in)
23:40:47*azimut quit (Remote host closed the connection)
23:40:48FromDiscord<girvo> In reply to @leorize "there's the *yeet to": yeah that would be basically perfect tbh
23:40:54FromDiscord<leorize> cooperative then should also be possible, but not built into the library
23:41:10FromDiscord<girvo> I dont even care if the clean up is automatic: i'd be happy to provide the cleanup procs even
23:42:02FromDiscord<Robyn [She/Her]> Still can't believe how small you trimmed the network code
23:42:10*azimut joined #nim
23:42:18FromDiscord<girvo> basically freertos tasks (read: thread) can't be cancelled/stopped/killed. so their scopes never truly exit, so nothing in them gets cleaned up if i stop the task. I want to fix that, but it's difficult as theres no real preemption that I have access to on an embedded system like this
23:42:23FromDiscord<leorize> because that code is now in ioqueue \:p
23:43:14FromDiscord<Robyn [She/Her]> Fair
23:43:34FromDiscord<Robyn [She/Her]> Hm, if I use cps in my own libraries, can users continue to use it as normal?
23:43:38FromDiscord<leorize> basically with sys/ioqueue, you write blocking code
23:44:01FromDiscord<Robyn [She/Her]> Since `readVarNum` and co are from other libraries (that I've written)
23:44:58FromDiscord<leorize> and cps + sys do the magic to make it run on the same threads
23:45:15FromDiscord<leorize> sys expose a bunch of cps procs so yes?↵(@Robyn [She/Her])
23:46:06FromDiscord<leorize> here's your `read`\: https://github.com/alaviss/nim-sys/blob/d361a03d2a4e02c8ee87328aa4207b142d302bc9/src/sys/files.nim#L153-L197
23:46:15FromDiscord<leorize> it's just a regular proc with `{.asyncio.}` on it
23:50:59FromDiscord<girvo> asyncio is cute btw, smart to not overload {.async.}
23:52:08FromDiscord<leorize> yea, ioqueue is meant to be a small part of the picture
23:52:14FromDiscord<leorize> but I think we will have to write a full queue eventually
23:54:06FromDiscord<Robyn [She/Her]> In reply to @leorize "sys expose a bunch": I mean can they simply call my code as if they never touched cps?
23:55:06FromDiscord<leorize> you can't do nim -\> cps easily but you can do cps -\> cps
23:55:29FromDiscord<leorize> my recommendation is to split it into a cps-compatible version and a non-cps compatible version
23:55:55FromDiscord<leorize> the logic should be easily split, the remainder is just I/O isn't it?