<< 09-12-2023 >>

00:01:50FromDiscord<guttural666> when your drunk programming efforts of 4 straight work hours yield a functioning threaded async http scheduler, fucking ooorah, thanks in no small part to the help of the great people in here 🥹
00:03:03FromDiscord<Elegantbeef> Just don't drink
00:04:07FromDiscord<guttural666> again, great feedback from you 🤣
00:05:17FromDiscord<guttural666> don't know how solid it is, probably some multithreading bugs in there
00:08:41FromDiscord<Elegantbeef> Not drinking is solid advice
00:14:04*azimut quit (Remote host closed the connection)
00:14:23*azimut joined #nim
00:32:57termergutteral666, How does it perform when you loadtest it with wrk or bombardier
01:59:48FromDiscord<czgchsz 🇭🇺 🇮🇶> Guys, is sushi filling? Would, say, 4 dragon rolls fill me or nah?
02:00:46FromDiscord<czgchsz 🇭🇺 🇮🇶> Never had sushi before
02:02:02FromDiscord<Elegantbeef> #offtopic is that way
02:02:15FromDiscord<czgchsz 🇭🇺 🇮🇶> Oh oops
02:46:14FromDiscord<apetransaction> just found out i could do this, 10/10 language https://media.discordapp.net/attachments/371759389889003532/1182875825519984681/170208997319797355.png?ex=658649f5&is=6573d4f5&hm=1dad46258091995374ef0b04b38bc599f375e5152178abe43541903a12775bdd&
02:46:47FromDiscord<Elegantbeef> Or you could do `openArray[byte or char]`
02:51:08FromDiscord<apetransaction> this feels like what i should definitely not be doing https://media.discordapp.net/attachments/371759389889003532/1182877058301444096/170209026720091269.png?ex=65864b1b&is=6573d61b&hm=5246442e161e24d1ceb540d05efad77c47098f0fc2e7d7a392e86b21d70fe2d0&
02:51:12FromDiscord<apetransaction> is there a better way or nah
02:51:24FromDiscord<apetransaction> (edit)
02:51:42FromDiscord<apetransaction> the cast seems iffy based on what ive already heard
02:51:48FromDiscord<Elegantbeef> Use an overload that just does it internally
02:51:58FromDiscord<apetransaction> In reply to @Elegantbeef "Use an overload that": im a stupid i dont know what that is
02:52:18FromDiscord<Elegantbeef> instead of using a generic just make multiple procs that do the conversion internally
02:52:26FromDiscord<apetransaction> oh
02:52:30FromDiscord<apetransaction> i forgot i could do that
02:52:31FromDiscord<Elegantbeef> `cast[string]` is wrong from `seq` -\> `string` as there is no `\0` at the end
02:52:33FromDiscord<Elegantbeef> So it's not ideal
02:52:49FromDiscord<apetransaction> thanks
02:53:47FromDiscord<apetransaction> nim is amazing
03:21:11FromDiscord<farklenaut> no line number is provided and I think the logic is sound, any way to get a more specific line number
03:22:39FromDiscord<farklenaut> sent a code paste, see https://paste.rs/T4u0T
03:25:52*edr quit (Quit: Leaving)
03:35:22FromDiscord<Elegantbeef> Are you building with `-d:release`?
03:35:35FromDiscord<Elegantbeef> If so enable `--stackTrace:on --lineTrace:on`
03:35:36FromDiscord<farklenaut> no
03:36:29FromDiscord<farklenaut> those don't provide any additional info
03:40:25FromDiscord<farklenaut> nm, math lib has lcm
03:42:07FromDiscord<Elegantbeef> Yea was going to refer you to that, but assumed that you wanted to do it from scratch
03:56:25*krux02 quit (Remote host closed the connection)
04:42:50*Jjp137 joined #nim
05:10:30FromDiscord<apetransaction> so does casting strings mess with stuff because this hurts my head https://media.discordapp.net/attachments/371759389889003532/1182912131637727353/170209862928453375.png?ex=65866bc5&is=6573f6c5&hm=07b6bc9203b4454ce792931758e7d847849ebedaad04232766c8eea0edbfc5c5&
05:29:11FromDiscord<graveflo> sent a code paste, see https://paste.rs/4ibUB
05:32:42FromDiscord<apetransaction> for some reason the strings print the same but they're different lengths
05:32:44FromDiscord<apetransaction> im confused
05:33:12FromDiscord<Elegantbeef> Does the code use the `string` as a `cstring`?
05:33:19FromDiscord<Elegantbeef> Like I said `seq[byte]` is not nil terminated
05:33:30FromDiscord<apetransaction> maybe in the library but not anywhere in my code
05:33:52FromDiscord<apetransaction> sent a code paste, see https://paste.rs/oOPAM
05:33:57FromDiscord<apetransaction> the typeof says its both string
05:35:13FromDiscord<apetransaction> gonna try seeing if using add fixes the problem and its just cast being fucky
05:35:24*antranigv quit (Quit: ZNC 1.8.2 - https://znc.in)
05:35:47FromDiscord<Elegantbeef> Well it's likely that the underlying logic looks for a cstring so the `seq[byte]` gets garbage
05:37:27*antranigv joined #nim
05:47:37FromDiscord<graveflo> yea there is an inconsistency with the termination byte. Why use `cast` here though? I'm not 100% sure, but I think that `cast` is going to make a copy if that is what you are trying to avoid. If it didn't you might have to worry about the GC.
05:49:34FromDiscord<graveflo> and if you are going to make a copy you might as well just initialize a string the normal way. There is a lot less room for error that way too.
05:49:42FromDiscord<apetransaction> tried removing cast and making two different procs
05:49:50FromDiscord<apetransaction> its something with nimAES
05:50:04*arkurious quit (Quit: Leaving)
05:51:39NimEventerNew question by Nate Ackerman: Identifier construction in nim macros (instead of templates), see https://stackoverflow.com/questions/77630288/identifier-construction-in-nim-macros-instead-of-templates
06:21:00*antranigv quit (Quit: ZNC 1.8.2 - https://znc.in)
06:21:56*antranigv joined #nim
06:48:45*Lord_Nightmare quit (*.net *.split)
06:48:45*def- quit (*.net *.split)
06:48:45*Amun-Ra quit (*.net *.split)
06:48:45*hexeme quit (*.net *.split)
06:48:45*bcksl quit (*.net *.split)
06:48:45*cnx quit (*.net *.split)
06:48:45*deadmarshal_ quit (*.net *.split)
06:48:45*lain quit (*.net *.split)
06:48:45*adigitoleo quit (*.net *.split)
06:48:45*jmdaemon quit (*.net *.split)
06:48:45*mal`` quit (*.net *.split)
06:49:03*NimBot joined #nim
06:49:09*redj joined #nim
06:49:09*FromDiscord joined #nim
06:50:29*om3ga joined #nim
06:51:08*rockcavera quit (Remote host closed the connection)
06:52:50FromDiscord<alireza0x0> 1 dumb question
06:53:03FromDiscord<alireza0x0> what are the main difference between a nim ref type and cpp shared ptr?
06:53:12FromDiscord<alireza0x0> refrence counting mean the same thing for both right?
06:53:40FromDiscord<alireza0x0> i know there is a cycle collector that my trace the ref for cycles, im not talking about that so assume my question is only about arc
06:53:41FromDiscord<Elegantbeef> There is not much difference
06:54:08*lumidify joined #nim
06:54:08FromDiscord<alireza0x0> alright, nice
07:00:21FromDiscord<alireza0x0> is there any way to turn off cycle collector and call it manually by my own code, when i know when is the right time for cycle collector to run and clean things...?
07:01:48FromDiscord<Elegantbeef> You can call `RunOrc` or whatever it's called yes
07:02:26FromDiscord<Elegantbeef> [`Gc_runOrc` \`Gc](https://github.com/nim-lang/Nim/blob/0a7094450ec059e10da67d47a76d004d4972b368/lib/system/orc.nim#L421-L432)
07:02:29FromDiscord<Elegantbeef> Whoops
07:02:30FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/0a7094450ec059e10da67d47a76d004d4972b368/lib/system/orc.nim#L421-L432
07:04:26FromDiscord<alireza0x0> so , i can first call `GC_disableOrc` then run it mannualy but `GC_runOrc` ?
07:04:34FromDiscord<alireza0x0> when i wanted ofc
07:04:54FromDiscord<Elegantbeef> Yes
07:04:58FromDiscord<alireza0x0> with not but xd
07:05:27FromDiscord<alireza0x0> thanks for your help, appreciated ❤️
07:06:07FromDiscord<alireza0x0> by the way are you `beef331` on github?
07:07:04FromDiscord<Elegantbeef> That's what I'm told
07:14:30FromDiscord<alireza0x0> 👍
07:39:44madpropsi found it surprising that nim is still at 2.0
07:39:48madpropsvery stable
07:40:07madpropsno emergency patches
07:40:26FromDiscord<Elegantbeef> Do I sense sarcasm?
07:40:31madpropsno
07:40:46madpropssoftware tends to get patches
07:42:59FromDiscord<odexine> Personally I find it surprising that Nim is at 2.0
07:49:41madpropsdid something bad happen with the release?
07:49:44madpropsi haven't heard much
07:49:54madpropsor did something good happen
07:50:01madpropsor did nothing happen
07:50:04FromDiscord<Elegantbeef> No Nim is just notoriously buggy when you look at in anyway
07:50:26madpropsthat's a harsh criticism
07:50:43madpropsdoes that mean you abandoned it?
07:50:54FromDiscord<Elegantbeef> Hey I've contributed to the compiler.... that's a reasonable statement
07:51:00FromDiscord<Elegantbeef> No I love stockholm
07:56:46madpropswell bugs can be fixed
07:57:21FromDiscord<odexine> yes they can, but are they being fixed
07:57:34FromDiscord<Elegantbeef> I'm optimistic Araq's type graph change will fix many bugs
07:57:44FromDiscord<Elegantbeef> but whether it does and whether it gets merged is another thing
08:11:01*derpydoo joined #nim
08:11:03*derpydoo quit (Read error: Connection reset by peer)
08:21:12madpropswhoever ire4ever is they've been busy on nim
08:28:01FromDiscord<alireza0x0> https://media.discordapp.net/attachments/371759389889003532/1182961834857341018/image.png?ex=65869a0f&is=6574250f&hm=60f3dc24a846ad76f46c84517d25a51dd489d81b0af8484f955efd50839e7217&
08:28:24FromDiscord<alireza0x0> so guys, that means c++ shared ptr is atomic and nims refc is not by default ?
08:29:01FromDiscord<odexine> nim's refc nor arc/orc iirc are atomic
08:29:12FromDiscord<odexine> no, arc does not stand for atomic refcounting
08:29:20FromDiscord<Elegantbeef> Nope there is a `--mm:atomicArc`, but bleh
08:29:32FromDiscord<odexine> yes but thats not arc xd
08:29:36FromDiscord<alireza0x0> then atomic arc makes it like cpp shared ptr
08:29:50FromDiscord<alireza0x0> the refrence counter it self will be atomic but the object will not
08:30:01FromDiscord<Elegantbeef> Yes the atomic arc makes it so only one thread will attempt to free it
08:30:06FromDiscord<alireza0x0> and then i can use locks and safely acess my ref object between threads
08:30:24FromDiscord<Elegantbeef> There are `SharedPtr[T]` inside `nim-lang/threading` which also serve the same point
08:30:50FromDiscord<alireza0x0> hmm
08:30:57FromDiscord<alireza0x0> it would be nice if we could forexample
08:31:03FromDiscord<alireza0x0> had a pragam to tell the compiler
08:31:10FromDiscord<alireza0x0> this ref requires atomic rc
08:31:15FromDiscord<alireza0x0> {.atomic.}
08:31:17FromDiscord<alireza0x0> forexapmle...
08:31:37FromDiscord<Elegantbeef> There are issues with that, but yes it'd be nice if there was as a `atomicref T`
08:36:17*derpydoo joined #nim
08:37:19*azimut quit (Ping timeout: 240 seconds)
08:38:59*mahlon quit (Ping timeout: 264 seconds)
08:46:39*mahlon joined #nim
09:33:25*redj quit (Remote host closed the connection)
09:35:18*redj joined #nim
09:39:40FromDiscord<firasuke> Ok this is huge:↵https://github.com/nim-lang/RFCs/issues/543
09:43:38FromDiscord<odexine> cool stuff
10:04:56FromDiscord<alireza0x0> no plans to improve nim views...? 😢
10:17:14FromDiscord<xtrayambak> Hey guys, why is Nim compiling my code with no garbage collection and why is it complaining when I set it to `--gc:orc`?↵This is the error I get. https://media.discordapp.net/attachments/371759389889003532/1182989320555077652/image.png?ex=6586b3a8&is=65743ea8&hm=1fb99ccc238cc700e07f2c0d22de88be00bdcea19ba0c970ccbe5d2b9f7d54fa&
10:23:10FromDiscord<alireza0x0> to me it looks like you have --gc:none somewhere else as well
10:23:19FromDiscord<alireza0x0> maybe in a .cfg or .nims file
11:34:03FromDiscord<Phil> sent a long message, see https://paste.rs/AFjaF
11:40:03FromDiscord<Phil> Hmm first experiments appear to indicate that yes you can do that
11:40:49FromDiscord<Saeed Mahmoodi> hey there
11:41:06FromDiscord<Phil> Cheers
11:41:52FromDiscord<Phil> In reply to @xtrayambak "Hey guys, why is": I mean personally I'm mostly confused by the usage of the `--gc` flag as I'd expect `--mm`, other than that no clue
11:43:35FromDiscord<Chronos [She/Her]> In reply to @isofruit "Hmm first experiments appear": As long as you use the same name, yes afaik
11:43:50FromDiscord<Chronos [She/Her]> But also you can do `import module {.all.}` :P
11:51:44FromDiscord<parabola> hi y'all
11:52:12FromDiscord<parabola> may I ask a question about the programming language?
11:53:18FromDiscord<auxym> hello, yes
11:57:03FromDiscord<Phil> This is the channel for general questions regarding nim, mostly syntax figuring out or help with issues
11:57:09FromDiscord<Phil> (edit) "issues" => "issues, so sure"
12:13:56FromDiscord<xtrayambak> In reply to @isofruit "I mean personally I'm": Yeah, both of those work the same.
12:17:28FromDiscord<parabola> basically i'm writing a template and i need to return from the function where it's called
12:19:22FromDiscord<parabola> how can i do so? actually i get the error 'not allowed to return from here'
12:23:56FromDiscord<Phil> In reply to @parabola "how can i do": Do not regard a template as a proc. ↵A template can't be returned on because there's nothing to return to.↵A template is a copy paste into your proc.↵It is there
12:24:55FromDiscord<Phil> The problem here is less one of syntax where you want to return from template and more one of concept - Where you're trying to solve a problem with the wrong tool in the first place.
12:25:06FromDiscord<Phil> (edit) "place." => "place and are slamming into limitations."
12:26:55FromDiscord<parabola> i don't need to return a value from the template as if it was a proc, i need to state a return from within the template so when it is compiled it's basically the same thing to write "return" inside the proc
12:27:29FromDiscord<parabola> in poor words
12:27:42FromDiscord<Phil> basically you want to template-ify a guard clause
12:28:07FromDiscord<Phil> Best I can suggest there is turn the logic around:↵Don't return early, just only execute a code-block if a condition is fulfilled.
12:28:13FromDiscord<parabola> i know for instance than in rust i could achieve something like this
12:28:50FromDiscord<parabola> can i achieve what i want to do using a macro instead of a template?
12:29:20FromDiscord<parabola> btw i'm very new to nim
12:29:47FromDiscord<Phil> Yes, though I'd look into whether you can just not do a template in the first place.
12:29:57FromDiscord<Phil> (edit) "place." => "place and use procs/generics instead."
12:30:44FromDiscord<Phil> But I'd need more info about the problem you're tackling to help with that
12:30:53FromDiscord<parabola> unfortunately i can't copy paste the affected code, but thanks i'll try another approach
12:30:54FromDiscord<Phil> (edit) "But I'd need more info about the problem you're tackling to help with that ... " added "and recommend anything"
12:38:49FromDiscord<Phil> In reply to @parabola "unfortunately i can't copy": I think elaborating on the idea might already help ^^
12:40:46FromDiscord<Phil> In reply to @parabola "unfortunately i can't copy": Note another approach to get past it is to turn off the template checks that typically prevent you from doing this kind of stuff (e.g. to prevent you from making assumptions on how the template will be called).↵You can do so using the dirty pragma that I forgot earlier
12:43:28FromDiscord<Phil> sent a code paste, see https://paste.rs/nYyNo
12:45:38FromDiscord<odexine> ...? the dirty pragma is not needed in your example
12:46:24FromDiscord<Phil (he/him)> I pretty much added it pre-emptively as parabola mentioned they were having problems with that approach
12:47:10FromDiscord<Phil (he/him)> But yeah, also compiles without, so now I'm confused where the error message they mentioned stems from
12:48:08FromDiscord<Phil (he/him)> Mostly because that error message sounded familiar so I swear I enocuntered it as well before and that was what I got stuck in my mind relating to it - That you can't return from a template because there's nothing to return to, you're already where you're trying to be
13:09:05FromDiscord<parabola> oh that's really useful, thank you ^↵(@Phil)
13:09:22FromDiscord<Phil> In reply to @parabola "oh that's really useful,": Note the correction by rika that dirty actually isn't needed here
13:09:30FromDiscord<Phil> But happy that helps!
13:10:35FromDiscord<9ih> how are so many bots talking in this server
13:10:55FromDiscord<Chronos [She/Her]> Matrix bridge
13:11:00FromDiscord<Phil> Secretly its all... dangit chronos
13:11:05FromDiscord<odexine> bridge for alternate chat services
13:11:06FromDiscord<Chronos [She/Her]> Pfffff
13:11:16FromDiscord<Phil> I wanted to make this joke for the brasillionth time
13:11:17FromDiscord<9ih> that makes like way more sense
13:11:24FromDiscord<odexine> In reply to @isofruit "Secretly its all... dangit": i mean you coulda made it about another matrix, like the matrix movie
13:13:33FromDiscord<parabola> but i resolved with creating multiple procs and using an Option as return value
13:13:35FromDiscord<parabola> btw i have another question, but i'm not good at formulating them hahah
13:13:37FromDiscord<parabola> also because english is not my main language, so i'll do an example if i may
13:13:59FromDiscord<parabola> basically in rust i could have an enumeration with specific variants that encapsulate an inner value, and based on the variant name i could unwrap its value fairly easily
13:14:01FromDiscord<parabola> now i know that in nim we can't have enum variants with values, but how could we achieve such behaviour?
13:14:31FromDiscord<Phil> What you're describing sounds to me like an object variant
13:15:27FromDiscord<odexine> enums in rust are not equivalent to enums in nim yes, so you have to make an object that uses an enum as a "discriminator", where you can have different fields depending on the enum vlaue
13:15:29FromDiscord<odexine> (edit) "vlaue" => "vale"
13:15:31FromDiscord<odexine> (edit) "vale" => "value"
13:15:34FromDiscord<parabola> so i know that we can discriminate the fields of an object (i've seen it in the tutorial)
13:16:28FromDiscord<parabola> and that's what i did, but do i necessarily have to have different names for the fields? it looks like they can't have the same name but with different types
13:17:36FromDiscord<Phil> Ah, you're running into the problem that you have field that some of your variants should have, but not all of them?
13:18:40FromDiscord<parabola> it's a field that all variants have,but it's of different type depending on the discriminator field
13:19:55FromDiscord<Phil> Then yeah, that one you can't express in nim. A field that is identical between all variants must be the same for all variants, including in type.↵The idea is that if your type changes, its not the same field
13:20:18FromDiscord<Phil> However this does make it sound somewhat like a generic might be the way to go
13:20:52FromDiscord<parabola> uuh yeah haven't thought about generics before
13:21:26FromDiscord<parabola> thanks really helpful people!
13:21:33FromDiscord<Phil> Generics are basically kind-of proc-templates:↵They automatically get copy pasted where they are called with the specific types they're being called with
13:21:56FromDiscord<Phil> This is the source of why I always say generics aren't real (as in, they're not real procs, they don't have pointers, the things they spawn do) 😄
13:23:36FromDiscord<parabola> btw i'm learning nim and it seems like really damn good, it definitevely should be more popular
13:28:22FromDiscord<Phil> I mean it seems to see some level of resurgence recently, I've been seeing a surprising amount of new faces over the last month or so
13:30:07FromDiscord<Phil> On that note, now I'm kinda stuck on API design. I have my PoCs nailed down, just several ways to allow the user interacting with stuff and pondering which is the least confusing.
13:31:35FromDiscord<parabola> are you part of nim project?
13:31:53FromDiscord<Phil> Not at all, I contribute to a couple projects and have a few minor packages here and there
13:32:28FromDiscord<Phil> I do file the occasional bug report and help with modding, that's pretty much my level of involvement.↵The folks doing compiler-dev are others
13:32:41FromDiscord<Phil> (edit) "modding," => "moderation,"
13:32:50FromDiscord<parabola> are them in this room?
13:33:41FromDiscord<Phil> Some that do compiler-dev are, but the more prolific ones for compiler-dev I don't think check here, they're in #internals (which is a bit stricter in adhering to its core topic)
13:34:03FromDiscord<parabola> oh cool
13:46:03FromDiscord<Phil> I kind of want a table of cachetables =/
13:47:05FromDiscord<nnsee> In reply to @9ih "how are so many": it's the AI revolution
13:48:30FromDiscord<Phil> I want users to register types with my package and store them in a central CacheTable of sorts, associating each type with the name the user gives.
13:48:52FromDiscord<Phil> I guess a table of CacheSeqs would be more accurate
13:51:05FromDiscord<Phil> And then later down the line I want the user to say "Create me message-variants and channels for these 2 names I registered stuff under, for sending messages back and forth between these two threads"
14:16:25*azimut joined #nim
14:16:34*derpydoo quit (Ping timeout: 260 seconds)
14:17:37FromDiscord<odexine> In reply to @isofruit "I kind of want": why
14:17:45FromDiscord<odexine> ah
14:23:29*azimut_ joined #nim
14:23:42*azimut quit (Remote host closed the connection)
14:33:52*rockcavera joined #nim
14:37:27FromDiscord<alireza0x0> can someone share some projects that written in nim with multi threading support? i need to see examples as much as possible, Thanks
14:40:08FromDiscord<michaelb.eth> In reply to @alireza0x0 "can someone share some": https://github.com/status-im/nim-taskpools↵https://github.com/Araq/malebolgia
14:40:35FromDiscord<michaelb.eth> https://github.com/mratsim/weave
14:41:38FromDiscord<michaelb.eth> https://github.com/nim-works/loony
14:45:51FromDiscord<alireza0x0> good, but real usecase examples...?
14:46:00FromDiscord<michaelb.eth> In reply to @alireza0x0 "can someone share some": if you want to parallelize workloads, then within some constraints on how you use the language, it's quite do-able, and with pretty good results!↵↵if you want relatively unstructured/ad hoc concurrency with non-copy data sharing across threads (i.e. `ref` across threads), there's no story for that at present
14:46:03FromDiscord<alireza0x0> something like a project that works with networking using multiple threads...
14:46:37FromDiscord<alireza0x0> the thing i want actually to share my tcpserver across threads
14:46:49FromDiscord<alireza0x0> i create a streamserver in chronos, thats a ref object being returned
14:47:03FromDiscord<alireza0x0> and also i cannot use isolate to pass it around threads
14:47:18FromDiscord<alireza0x0> and that ref object is also being tracked by chronos it self looks like
14:47:30FromDiscord<alireza0x0> very hard situation to deal...
14:47:39FromDiscord<alireza0x0> the only way i think is to change my design goals
14:47:43FromDiscord<michaelb.eth> I get it, have wanted the same thing myself
14:47:57FromDiscord<michaelb.eth> there's no blueprint for that at this time
14:48:15FromDiscord<alireza0x0> the last thing i have in my mind is
14:48:33FromDiscord<alireza0x0> forexample unregister the streamserver from epoll first...
14:48:47FromDiscord<alireza0x0> then only pass fd (as a ptr,int) to new thread
14:49:02FromDiscord<alireza0x0> then set things up again... but that wont work if i want my state as well...
14:54:06FromDiscord<System64 ~ Flandre Scarlet> Thanks, garbage collector https://media.discordapp.net/attachments/371759389889003532/1183058998400921610/image.png?ex=6586f48d&is=65747f8d&hm=37abaebb1b2f4c0a225d3b8212cfb3802b6b9b8a34a7235e8b409b5a6b079fd0&
14:58:13FromDiscord<michaelb.eth> @alireza0x0 if it's not a deal-breaker (re: Nim), consider breaking up your program into parent/child processes that communicate async across process boundaries
15:01:01FromDiscord<michaelb.eth> that surely "kicks the can" re: shared state, but could help you to think about minimum-viable shared state and how to achieve consistency for it
15:01:25FromDiscord<michaelb.eth> (edit) "that surely "kicks the can" re: shared state, but could help you to think about minimum-viable shared state ... and" added "for your use case"
15:19:04*fallback quit (Ping timeout: 256 seconds)
15:32:11*jmdaemon quit (Ping timeout: 256 seconds)
15:45:21NimEventerNew post on r/nim by qtless: The HappyX Web Framework Will Have JVM Bindings, see https://reddit.com/r/nim/comments/18eg8c5/the_happyx_web_framework_will_have_jvm_bindings/
15:45:46FromDiscord<Phil> Okay at this point that guy is just flexing on every other language in existance
15:46:19FromDiscord<Phil> 😄
15:50:17FromDiscord<apetransaction> does anyone know a way to convert a sequence of random bytes from `sysrand/urandom` to a string
15:51:38FromDiscord<Phil> Personally I tend to just cast to string
15:52:59FromDiscord<Phil> or seq[char] which is likely better
15:53:04FromDiscord<Phil> (edit) "better" => "more accurate"
15:54:06*fallback joined #nim
15:56:19FromDiscord<apetransaction> the functions for nimAES only work with strings, and im trying to use urandom for a key and IV
15:58:00FromDiscord<michaelb.eth> nim-stew has a helper for that, just a sec, will find it
15:59:01FromDiscord<michaelb.eth> In reply to @apetransaction "does anyone know a": you want `string.fromBytes(...)`↵https://github.com/status-im/nim-stew/blob/master/stew/byteutils.nim#L252
15:59:40FromDiscord<michaelb.eth> note: the `string.` is important because the first parameter is `T: type string`
15:59:43*azimut_ quit (Ping timeout: 240 seconds)
16:01:23NimEventerNew thread by oyster: Run another program, then kill/quit self on windows?, see https://forum.nim-lang.org/t/10751
16:06:44FromDiscord<michaelb.eth> In reply to @isofruit "or seq[char] which is": I don't disagree per se, but one of the unfortunate things when looking at `seq[char]` (literally that type) is that the "uninitiated" may assume that `string`s are simply sequences of characters, when in fact `string` in Nim is UTF-8 so a "character" in the stream may be 1-4 bytes long, i.e. may be comprised of 1-4 consecutive `type char`, which is nearly equivalent to `type byte`
16:07:57FromDiscord<michaelb.eth> I know you know that already, mainly writing it aloud in case someone reading it isn't... bleh, seems like we could figure out some way with the type system for that to be communicated more clearly
16:13:21FromDiscord<apetransaction> prolly being stupid, how do i get an open array from a seq
16:14:03FromDiscord<michaelb.eth> https://nim-lang.org/docs/system.html#toOpenArrayByte%2Cseq%5Bchar%5D%2Cint%2Cint
16:14:28FromDiscord<apetransaction> In reply to @michaelb.eth "you want `string.fromBytes(...)` https://github.com": the from bytes only takes an open array of bytes
16:14:47FromDiscord<apetransaction> In reply to @michaelb.eth "https://nim-lang.org/docs/system.html#toOpenArrayBy": that takes in chars
16:14:58FromDiscord<Phil> Sidenote, michaelb did you ever have the need for more... "expansive" macrocache utils?↵Like wanting to store a seq of proc-NimNodes in a CacheTable?
16:15:10FromDiscord<michaelb.eth> sure, you'll need to transform it
16:15:22FromDiscord<michaelb.eth> whoops meant to be a reply to @apetransaction
16:15:47FromDiscord<Phil> What I'm currently doing is I made myself a CacheTable in which I store an nnkStatementList of all the proc-nodes I have and provide procs to pack/unpack values from that nnkStatementList
16:15:55FromDiscord<Phil> (edit) "an nnkStatementList" => "nnkStatementLists"
16:16:24FromDiscord<michaelb.eth> In reply to @isofruit "Sidenote, michaelb did you": I saw you write something about that earlier, but didn't take a close look, what's the use case?
16:19:40*fallback quit (Ping timeout: 276 seconds)
16:20:50FromDiscord<michaelb.eth> thought so 😄
16:21:24FromDiscord<Phil> The first approach was just for a PoC and rather "dumb", basically I assumed only 2 threads ever and hard coded "client" and "server" routes and provided macros specific for that
16:21:48FromDiscord<Phil> Now I'm generalizing from there - You only register "routes" and associate them with a name and I generate everything based on that
16:22:22FromDiscord<Phil> sent a long message, see https://paste.rs/hEEcw
16:23:25FromDiscord<Phil> Basically you tell me "Register this route for the name 'server'" etc.↵Then after all that is done, later you tell me "Generate the MessageType that 'server' can receive"
16:24:06FromDiscord<Phil> (edit) "receive"" => "receive and a routing proc so that the message-type gets unpacked into its key message field and passed on to its handler proc""
16:24:15FromDiscord<michaelb.eth> don't mean to be unresponsive, putting some thoughts together
16:24:51FromDiscord<Phil> Absolutely fair, I've been mulling this over for like a week now ever since one guy came into an owlkettle discussion and asked how to run a chess engine in a thread parallel to owlkettle and I had no response xD
16:25:03FromDiscord<Phil> (edit) "https://paste.rs/m4cT9" => "https://paste.rs/46u7X"
16:25:16FromDiscord<Phil> Been working on this (and daily wondering if a "client-server" type architecture between threads more generally) is even the right approach
16:25:36FromDiscord<Phil> (edit) "generally)" => "generally" | "approach" => "approach) ever since"
16:28:55*fallback joined #nim
16:32:07FromDiscord<piqueiras> btw any pros here doing advent of code? would like to see nim in action performing those weird challenges
16:37:26FromDiscord<Phil> PMunch is
16:37:32FromDiscord<Phil> He streams even
16:37:33FromDiscord<Phil> Daily
16:40:25FromDiscord<Phil> In fact his last streem was a mere 20 hours ago so maybe he'll do it today as well
17:00:15FromDiscord<spotlightkid> @piqueiras\: #nim-aoc\:matrix.org
17:22:37FromDiscord<thisroomdoesnotexist> hi guys. i'm trying to learn nim. Is this the correct channel to ask questions?
17:22:49*rockcavera is now known as Guest4253
17:22:49*tiorock joined #nim
17:22:49*Guest4253 quit (Killed (cadmium.libera.chat (Nickname regained by services)))
17:22:49*tiorock is now known as rockcavera
17:30:45FromDiscord<demotomohiro> yes
17:34:37*azimut joined #nim
17:35:09*fallback quit (Ping timeout: 256 seconds)
17:40:57FromDiscord<Phil> Have you found the docs on object variants already?
17:41:18FromDiscord<Phil> Or is this going a tad deeper, asking on how to make the variant generic/more flexible?
17:41:29FromDiscord<thisroomdoesnotexist> I found a question on a forum, and the answer to it, but I didn't know if that is the idiomatic way of doing it in nim
17:41:55FromDiscord<thisroomdoesnotexist> Do you guys have a good book I could read about nim?
17:42:05FromDiscord<demotomohiro> In reply to @thisroomdoesnotexist "So I am trying": https://nim-lang.org/docs/manual.html#types-object-variants↵Object variant is Nim's sum type.
17:42:10FromDiscord<thisroomdoesnotexist> sent a long message, see https://paste.rs/PX7Iv
17:42:23FromDiscord<Phil> Generally union types are represented as object variants, it's also how I personally would implement a result-type and IIRC how status (a larger company using nim) implements them in their result lib
17:44:19FromDiscord<Phil> In reply to @thisroomdoesnotexist "So I am trying": Note that given your expectations here from TS though, nim's type system isn't quite as flexible as the one from TS since it is a tad stricter and generics are more "pieces of code the compiler can copy-paste with explicit types".↵You don't need to fully understand that yet, but keep that in mind should you run into problems.
17:44:39FromDiscord<Phil> Sure, you can always <module>.<symbolname>
17:45:08FromDiscord<thisroomdoesnotexist> okay, then there must be a problem with the way I've setup the linter as it's throwing errors on my vscode
17:45:38FromDiscord<demotomohiro> In reply to @thisroomdoesnotexist "I have a more": You can calls procs in module without module name just by importing module like `import io`.
17:45:44FromDiscord<Phil> Could you post the code-snippet?
17:45:59FromDiscord<Phil> (ideally including your import-section)
17:46:24FromDiscord<thisroomdoesnotexist> sent a code paste, see https://paste.rs/f5ghW
17:48:48FromDiscord<thisroomdoesnotexist> https://media.discordapp.net/attachments/371759389889003532/1183102963506479134/Screenshot_2023-12-09_at_6.48.29_PM.png?ex=65871d7f&is=6574a87f&hm=d347c00d51f8ba15c9ce2d55fefb8254ab0d106664821a16d7e1a437a9aefd02&
17:49:25FromDiscord<bostonboston> What's the error on import io
17:49:50FromDiscord<thisroomdoesnotexist> https://media.discordapp.net/attachments/371759389889003532/1183103219791056966/Screenshot_2023-12-09_at_6.49.36_PM.png?ex=65871dbc&is=6574a8bc&hm=973caed1f21873614f2f9685713ac2bd1ca67c2b708854926a1bc53c4040e035&
17:49:58FromDiscord<demotomohiro> In Nim, procs are not exported in default.↵You need to add '' after proc name to export.
17:50:13FromDiscord<thisroomdoesnotexist> sent a code paste, see https://paste.rs/TiaK8
17:50:20FromDiscord<Phil> In reply to @bostonboston "What's the error on": The fact one is trying to import io in the first place appears to be the error
17:50:35FromDiscord<bostonboston> That's what I'm thinking
17:50:39FromDiscord<thisroomdoesnotexist> yeah, so it seems like i have issues with my setup
17:51:24FromDiscord<bostonboston> because io is apart the of the system module you shouldn't (and maybe can't) import it
17:51:25FromDiscord<demotomohiro> If you are using Nim 2.0, std/syncio is what you want.
17:51:30FromDiscord<Phil> Trying to figure out the path of io since io by default is provided via systems which is implicitly-imported
17:51:54FromDiscord<thisroomdoesnotexist> so I don't need to import io?
17:52:03FromDiscord<Phil> Nope
17:52:21FromDiscord<Phil> I assume you wanted it to ensure you know where which proc comes from
17:52:50FromDiscord<Phil> Your problem was that there is no io module, likely because with nim2.0 it was split up.↵That was what demotomohiro was pointing out
17:53:00FromDiscord<thisroomdoesnotexist> is there asyncio.readFile? is there such a concept of async await in nim?
17:53:31FromDiscord<thisroomdoesnotexist> perfect, this works, thank you guys
17:54:40FromDiscord<Phil> sent a code paste, see https://paste.rs/DCtwV
17:55:40FromDiscord<Phil> And waitFor will block the thread until something is finished
17:55:51FromDiscord<thisroomdoesnotexist> yes that makes sense to me. I have some experience with rust as well so i might be able to navigate my way to a working solution
17:56:37FromDiscord<thisroomdoesnotexist> another interesting thing i noticed is the none(string). Is this behavior because of the way types work in nim (things compiler can replace) that you explained ealier?
17:56:51FromDiscord<Phil> sent a long message, see https://paste.rs/zYM7y
17:56:59FromDiscord<Phil> Check.↵You'll need to read up on that a bit yourself as the upser low-level async bits are things that I'm also only partially informed on, I haven't implemented my own event-loop or the like 😄 ↵As for async-io, errrr I'd need to go search for that
17:57:12FromDiscord<Phil> https://nim-lang.org/docs/asyncfile.html
17:57:44FromDiscord<thisroomdoesnotexist> yes, i think it's clear that I need to read more to even form meaningful learning questions
17:58:24FromDiscord<thisroomdoesnotexist> one last thing though. Is there such a thing as aliased imports. In typescript for example, you can do /src/...↵and every import can start from src, can I do that in nim as well without doing relative imports
17:59:03FromDiscord<Phil> In reply to @thisroomdoesnotexist "another interesting thing i": Pretty much. Option and its procs are just a generic, it needs to be told what type it is.↵If you write some("Some string") then the compiler can easily figure out that this is an option type wrapping a string.↵If you just write none() the compiler can't properly infer the type and is raising question marks. Thus you need to provide a type there so that it can figure out
17:59:17FromDiscord<Phil> (edit) "https://paste.rs/GKWpu" => "https://paste.rs/qId2d"
17:59:43FromDiscord<Phil> In reply to @thisroomdoesnotexist "one last thing though.": Pretty sure you can, I just never do, one sec
18:01:08FromDiscord<thisroomdoesnotexist> ?
18:03:14FromDiscord<thisroomdoesnotexist> sent a code paste, see https://paste.rs/qWRCy
18:03:29FromDiscord<Phil> You basically should be able to import files relative to your src directory
18:04:00FromDiscord<thisroomdoesnotexist> sent a code paste, see https://paste.rs/kFOF6
18:05:48FromDiscord<Phil> Hmm no just blew up in a slightly different setup, trying around a bit more
18:06:44FromDiscord<Phil> sent a code paste, see https://paste.rs/iRBfY
18:08:03FromDiscord<Phil> https://discord.com/channels/371759389889003530/371759389889003532/1177912224988282911↵Ah, I knew there was a time earlier where I discussed this with beef, see here the last convo and your options related to imports
18:09:10FromDiscord<Phil> (edit) "https://paste.rs/L9iBX" => "https://paste.rs/Tm6JV"
18:10:28FromDiscord<thisroomdoesnotexist> alright I will do so, thank you for trying things out for me
18:11:39*fallback joined #nim
18:26:02FromDiscord<Phil> Happy to help in what limited capacity I can 🤒👍
18:31:12FromDiscord<Phil> Man I should've started with the generalized version, by lord does that make the code cleaner
18:34:51FromDiscord<spotlightkid> > one last thing though. Is there such a thing as aliased imports. In typescript for example, you can do /src/...↵> and every import can start from src, can I do that in nim as well without doing relative imports↵I thought aliased imports where this\: https://nim-lang.org/docs/manual.html#modules-module-names-in-imports↵What you describe is module search path manipulation, is it not?
18:50:44FromDiscord<Phil> I understand if that's not possible, I just don't particularly care for them atm
18:51:23FromDiscord<Phil> (Time to secretly summon Elegantbeef who I think may be coming online soon)
18:52:13FromDiscord<Phil> sent a code paste, see https://paste.rs/pb3yG
19:12:08FromDiscord<rakgew> ^^ I am fairly certain this did compile on 1.6.14 (as I have a running binary from there), but now on 2.0.0 I get the error.
19:12:32FromDiscord<rakgew> sent a code paste, see https://paste.rs/DSbdt
19:16:30FromDiscord<rakgew> as soon as I remove access of said proc to the global variable, it compiles again, but I would like to use that information to color highlight the current active api..
19:19:05Amun-Raprocs accesing global vars were gcsafe in 1.6?
19:22:56FromDiscord<rakgew> I don't know.↵but it must have compiled somehow, as I can run "show\_apis" in the application compiled with 1.6.14
19:29:52FromDiscord<rakgew> I mean I happily change it to something else, but I am currently not sure how else I would set the setting of the current active api globally.↵the idea is that the user can switch the currently used api.
19:32:15FromDiscord<rakgew> this cli-app (repl-like) uses the ordered table to dispatch witch procs to call when the user entered a matching name. (it also feeds the help and autocomplete)
19:59:03FromDiscord<guttural666> got an http request scheduler here, maybe somebody can tell me if this makes sense or contains obvious multithreading bugs etc. thanks!↵https://gitlab.com/hansdampfinger666/thread_test
20:10:08*xet7 joined #nim
20:10:31*azimut quit (Ping timeout: 240 seconds)
20:13:54*azimut joined #nim
20:22:45*fallback quit (Ping timeout: 256 seconds)
20:35:48FromDiscord<Elegantbeef> @Phil mark the template `{.dirty.}`
20:36:17FromDiscord<Phil> That's stuff generated from a quote do block
20:36:35FromDiscord<Elegantbeef> put `{.inject.}` on all the symbols
20:39:19FromDiscord<Elegantbeef> rakgew you'll likely need to cast around the global variable or make the handler not gcsafe
20:43:22FromDiscord<ElegantBeef> Not inside accquotes
20:43:32FromDiscord<ElegantBeef> `let msgWrapper {.inject.}: ....`
20:43:35*redj quit (Ping timeout: 268 seconds)
20:43:47FromDiscord<ElegantBeef> `msg {.inject.}: T`
20:44:11FromDiscord<ElegantBeef> Lexical stropping , strops
20:44:20FromDiscord<Phil> sent a code paste, see https://paste.rs/M7ki3
20:45:46FromDiscord<ElegantBeef> @guttural666 I'd suggest using valgrind and memory santizers to check for any issues
20:46:29FromDiscord<ElegantBeef> No look at the generated code
20:46:32FromDiscord<ElegantBeef> `msgWrapper`
20:46:42FromDiscord<ElegantBeef> instead of `msgWrapper'gensym`
20:47:04FromDiscord<ElegantBeef> If you want to have symbols verbatim you have to use `let name = ident"..."`
20:47:08FromDiscord<ElegantBeef> or use genast and be more sane
20:47:34FromDiscord<ElegantBeef> `genast(msg = ident"msg", hub = ident"hub", msgWrapper = ident"msgWrapper")`
20:48:19FromDiscord<Phil> sent a code paste, see https://paste.rs/Mpu8X
20:48:25FromDiscord<ElegantBeef> Though I think genast is dirty by default
20:48:28FromDiscord<ElegantBeef> It has optiosn though
20:56:34*azimut quit (Remote host closed the connection)
20:56:52*azimut joined #nim
21:01:00FromDiscord<rakgew> thank you ElegantBeef - how would I do either of that?↵is there somewhere where I can read up on this? I am currently resorting to writing plain old elif statements in the repl main loop (which seem to work) potentially with a template/macro later.
21:01:02FromDiscord<Elegantbeef> `{.cast(gcsafe).}: #'unsafe' code here` is the simplest explanation
21:01:04FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#effect-system-gc-safety-effect
21:01:05FromDiscord<Elegantbeef> Or for your callback you can make the type `proc()` which does not imply `gcsafe`
21:01:15FromDiscord<rakgew> Elegantbeef \: thank you so much for the link and explanations!↵I will read there. \:-D
21:03:59FromDiscord<Phil> Can I forward declare a type 😅 ?
21:04:24FromDiscord<Phil> Nope, hmmm
21:05:58FromDiscord<rakgew> nice - the cast gcsafe works like a charm! \:-D
21:06:00FromDiscord<rakgew> could that cast gcsafe have negative effects?
21:06:01FromDiscord<␀ Array> whats that nim compiler flag that removes the underscore followed by 9 numbers?
21:06:04FromDiscord<␀ Array> in the js target
21:07:42FromDiscord<Phil> I'm running into this circular dependency issue where I need an AppState on owlkettle to know the types I generate so it can use them to make calls to the server, while I need the procs that get generated together with the types in order to manipulate the AppState when an event happens.↵This would be less of an issue if I could inject the types I generate into the type-block from owlkettle but that sounds impossible =/
21:08:58FromDiscord<mou_bugtracker> sent a code paste, see https://paste.rs/aZ5QU
21:09:13FromDiscord<Phil> In reply to @mou_bugtracker "Hi, community. I recently": I'm not aware of any, the way to go here would be to use either one of the packages that provide more support for functional programming and see what they provide, or use the bits of nim that let you write kind-of list-comprehension like syntax
21:09:23*fallback joined #nim
21:11:04FromDiscord<Phil> Though nevermind, that wouldn't solve your problem either because of any... yeah I got nothing
21:11:13FromDiscord<Phil> (edit) "Though nevermind, that wouldn't solve your problem either because of any... yeah I got nothing ... " added "except for looking at functional programming packages"
21:11:16FromDiscord<Elegantbeef> the `pairs` iterator is an inline iterator so it cannot be sent to a procedure as it's just a fancy template
21:11:43FromDiscord<Elegantbeef> If you do not want to do pointless allocations you have to write the loop yourself
21:12:44FromDiscord<Elegantbeef> Yes it hides away any possible gc unsafe access, it's overriding thread analysis
21:13:05FromDiscord<mou_bugtracker> (edit) "https://paste.rs/QeTW8" => "https://paste.rs/BMLac"
21:14:37FromDiscord<mou_bugtracker> In reply to @isofruit "I'm not aware of": Thank you, guys. Did not noticed inline effect previously. Will follow your suggestion about implicit loop. And will read more Nim code to learn more idiomatic patterns.
21:15:12FromDiscord<Elegantbeef> @Phil got a demonstration of the problem?
21:15:22FromDiscord<Phil> Yeah, one sec
21:15:34FromDiscord<Phil> I'm basically currently having a hideous solution and trying to clean it up one problem at a time
21:22:57NimEventerNew question by Allon: Hack The Box CTF Challenge, see https://stackoverflow.com/questions/77632955/hack-the-box-ctf-challenge
21:27:39FromDiscord<Phil> Background: I'm setting up 2 threads: A GUI Thread for owlkettle and a background Thread for a "server".↵There's 2 channels that ping messages back and forth between them that get routed to "handler"-procs that you register with me via the `route` macro.↵The messages that get sent back and forth are of type of an Object Variant that I generate on the fly based on the handler-procs that you register.
21:27:59FromDiscord<Phil> (edit) "of type of an" => "2 different" | "Variant" => "Variants (one per channel)"
21:29:48FromDiscord<Phil> sent a code paste, see https://paste.rs/BqZME
21:29:54FromDiscord<Phil> It might be a smarter solution to give up on an object variant and just send JSON strings back and forth but that's so inefficient given that you may be copying a large string and then also parsing it back from JSON to a nim object =/
21:31:17FromDiscord<Elegantbeef> Question why do you need object variants?
21:32:22FromDiscord<Phil (he/him)> Channels can only let through one type of message.↵I have 2 options\:↵Either I create one channel per type of message you sent back and forth, or I generate 2 channels each of which sends a larger Object Variant from A to B or vice versa
21:33:00FromDiscord<Phil (he/him)> I went with the latter option for now as managing 2 channels and generating object variants seemed easier than managing an unknown amount of channels
21:33:58FromDiscord<Elegantbeef> As a stop gap you could send a distinct tuple across that has all the fields and an integer of the type id
21:34:07FromDiscord<Elegantbeef> It's not that smart, but it's better than Json
21:35:19FromDiscord<Phil (he/him)> While true, this is also for a library to simplify setting up dual-thread applications (where basically you have one frontend client and one "server").↵I thus can't know anything about the fields that may be needed
21:37:10FromDiscord<Elegantbeef> I need to have a think about the problem here 😄
21:39:32FromDiscord<Phil (he/him)> If you want sourcecode, I have a repo with 2 branches with functional examples. The code isn't particularly cleaned up as this isn't even fully past the PoC phase, but it allows interacting with it a bit and the examples at least log.There's both an owlkettle and a non-owlkettle example (basically you type stuff into the CLI and it gets sent to the server)\:↵↵https://github.com/PhilippMDoerner/Appster
21:40:56FromDiscord<Phil (he/him)> Both examples on both branches should work
21:43:17FromDiscord<Phil (he/him)> Really the entire idea is just client-server setup between 2 threads
21:43:19FromDiscord<Phil (he/him)> Really the entire idea is just client-server setup between 2 threads, which brings with it to solve the questions of "How do I get a message from A to B?" and "How do I route to message on B to appropriate handler-procs?" (The latter I generate a routing proc for)
21:43:26FromDiscord<Phil (he/him)> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1183161973001687184): Really the entire idea is just client-server setup between 2 threads, which brings with it to solve the questions of "How do I get a message from A to B?" and "How do I route the message on B to appropriate handler-procs?" (The latter I generate a routing proc for)
21:44:20FromDiscord<Elegantbeef> Personally for routing I'd use a `Table[pointer, pointer]` where the first `pointer` is `getTypeInfo` and the second pointer is the `proc(...., data: T)`
21:44:40FromDiscord<Elegantbeef> Now the same thing probably applies to channels imo
21:48:11FromDiscord<Elegantbeef> You do not need any macros for my suggestion it just adds a bunch more channels
21:48:35FromDiscord<Phil (he/him)> So your approach would be 1 channel per type of message to exchange between the 2 threads?
21:49:58FromDiscord<Phil (he/him)> sent a long message, see https://paste.rs/zf7KA
21:50:04FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/KjHyn
21:50:56FromDiscord<Elegantbeef> Maybe even 2 channels per type
21:50:58FromDiscord<Elegantbeef> It's not the prettiest, but it's a generic solution that works without macros
21:51:01FromDiscord<Elegantbeef> Yep
21:51:04FromDiscord<Elegantbeef> Which means it's way more auditable 😛
21:51:05FromDiscord<Phil (he/him)> Nah, asymmetric communication, a message from client to server is always different from a message from server to client.↵Even if type-wise they're identical, they should still be separate types because they represent different things that should be happening that should not depend on one another
21:51:06FromDiscord<Elegantbeef> What?
21:51:14FromDiscord<Phil (he/him)> I assume you meant 2 channels per type to be able to send a message from Thread A to B and then from B to A, right?
21:51:25FromDiscord<Phil (he/him)> \the same message type
21:51:35FromDiscord<Elegantbeef> Right they should be able to talk both ways no?
21:52:07FromDiscord<Phil (he/him)> Yeah but a thread should always either only listen or send on a channel imo, because otherwise you get into funny constellations where you don't know if you were the thread that sent the message in the channel
21:52:44FromDiscord<Elegantbeef> Well that's why you make it so your channel is a `OutChannel` or `InChannel` distinct 😛
21:52:54FromDiscord<Elegantbeef> But anywho that does not really matter
21:53:03FromDiscord<Phil (he/him)> Ah wait, missunderstood you, yes they should be able to talk both ways, but not through the same types.↵And aye, fair
21:53:08FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/wt7Yr
21:54:12FromDiscord<Phil (he/him)> Might open a third branch to try out your approach, the runtime cost seems manageable and I don't anticipate many channels being a potential problem
21:55:10FromDiscord<Elegantbeef> Yea never overlook `getTypeInfo`
21:55:16FromDiscord<Phil (he/him)> So for routes the `Table[pointer, pointer]` the first pointer is the pointer of the type, the second to the proc.↵↵What are the pointers for the channels?
21:55:35FromDiscord<Phil (he/him)> I assume the first is getTypeInfo again
21:55:48FromDiscord<Elegantbeef> Well the channel is earmarked for an event right"
21:55:59FromDiscord<Phil (he/him)> Ohhhhh a pointer to the channel so you don't have to provide the type
21:56:04FromDiscord<Elegantbeef> So in reality probably `(pointer, pointer)`?
21:56:21FromDiscord<Phil (he/him)> \provide the message type
21:56:29FromDiscord<Elegantbeef> Where it's `(data.getTypeInfo, procTypeInfo)`
21:56:45FromDiscord<Elegantbeef> Maybe even `(data.getTypeInfo, proc.getTypeInfo, name.getTypeInfo)`?
21:56:55FromDiscord<Elegantbeef> Whoops not `name.getTypeInfo` just `name`
21:57:04FromDiscord<Elegantbeef> Totally depends on how you need to fetch the channel later
22:02:26FromDiscord<Phil (he/him)> sent a long message, see <!doctype html>
22:02:48FromDiscord<Phil (he/him)> I might be able to throw out channel though if I say that each type must be unique to force you to not reuse types
22:03:01FromDiscord<Phil (he/him)> Can always use distinct types afterall
22:03:26FromDiscord<Phil> Wait, the typeInfo for distinct types is different I hope... one sec
22:03:42FromDiscord<Elegantbeef> It is
22:04:21FromDiscord<Elegantbeef> `getTypeInfo` on `ref object of X` will only return the type information of the static type if I recall correctly
22:04:36FromDiscord<Elegantbeef> Which might be a concern, but it's a mild issue if you ask me
22:05:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:05:29FromDiscord<Elegantbeef> Yep
22:05:50FromDiscord<Phil> Ahhhh Dangit, it's all the same pointer
22:06:06FromDiscord<Elegantbeef> I mean to be fair that's what you'd expect 😄
22:06:16FromDiscord<Phil> Yeah but not what I need 😄 !
22:06:22FromDiscord<Elegantbeef> Why not?
22:06:31FromDiscord<Elegantbeef> If you want to dispatch inside the proc use a method
22:06:45FromDiscord<Elegantbeef> The users can use a method for their ref type to dispatch the handler again
22:06:50FromDiscord<Elegantbeef> It's hardly a big concern if you ask me
22:07:43FromDiscord<Elegantbeef> Oh wait distincts share type info...
22:07:48FromDiscord<Phil> Yep
22:07:58FromDiscord<Elegantbeef> How'd I get around this in yeacs
22:08:02FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:08:19FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/master/yeacs.nim#L121-L124
22:08:21FromDiscord<Elegantbeef> Ah that's how
22:08:54FromDiscord<Phil> So you... gave all distincts the same "typeinfo" value?
22:09:00FromDiscord<Elegantbeef> No
22:09:02FromDiscord<Elegantbeef> It's a generic procedure
22:09:03FromDiscord<Phil> No wait, that's a generic
22:09:06FromDiscord<Phil> Huh
22:09:17FromDiscord<Elegantbeef> It instantiates `meh` per distinct which is `static` which means it outlives the procedure
22:09:31FromDiscord<Elegantbeef> As such it's sufficient for what we're doing since we're using the pointer as a typeID
22:09:46FromDiscord<Elegantbeef> The mild issue is that since we're using pointers the type IDs are not persistent
22:10:03FromDiscord<Elegantbeef> So each build type ids might move, so you cannot serialise state really
22:10:17FromDiscord<Phil> Okay, an approach I'll try out tomorrow. I have a cold and my brain is smoking already from even understanding my problem.↵I'm getting more used to the entire malleability of pointer stuff though... so this is what makes C so malleable
22:10:38FromDiscord<Elegantbeef> Yea my ECS heavily abuses the pointer decay 😄
22:10:47FromDiscord<firasuke> https://web-frameworks-benchmark.netlify.app/result?asc=0&metric=totalRequestsPerS&order_by=level512
22:10:55FromDiscord<firasuke> Since when was Nim at the top lol
22:10:58FromDiscord<firasuke> Still good to know
22:12:11FromDiscord<firasuke> Also this: https://lemire.me/blog/2023/10/07/web-server-hello-world-benchmark-go-vs-node-js-vs-nim-vs-bun/
22:13:49FromDiscord<Elegantbeef> The +- 60k is comical to me
22:14:16FromDiscord<Elegantbeef> Like 20% variance
22:17:40FromDiscord<firasuke> This is awesome to know
22:17:48FromDiscord<firasuke> nim 2.0 is really something
22:17:52FromDiscord<Phil> What in the flying fuck is Ethosa doing, like... are they on speed somehow?↵Their productivity appears to be
22:18:03FromDiscord<firasuke> and the roadmap for 2024 looks even crazier
22:18:08FromDiscord<firasuke> kudos to you
22:18:10FromDiscord<Phil> This is meant in the "This is crazy" and positive kind of way
22:18:39FromDiscord<Phil> In reply to @firasuke "kudos to you": To Ethosa?
22:19:00FromDiscord<firasuke> to every Nim developer
22:19:06FromDiscord<Phil> Ah, check
22:19:14FromDiscord<firasuke> and to Ethosa in particular for the links above
22:19:34FromDiscord<firasuke> people tend to appreciate these benchmarks more
22:35:58*fallback quit (Ping timeout: 256 seconds)
22:47:11*fallback joined #nim
23:54:01*Jjp137 quit (Ping timeout: 246 seconds)