<< 13-06-2024 >>

00:00:06*beholders_eye quit (Read error: Connection reset by peer)
00:06:05*beholders_eye joined #nim
00:10:41*beholders_eye quit (Read error: Connection reset by peer)
00:16:29*beholders_eye joined #nim
01:17:52*beholders_eye quit (Ping timeout: 255 seconds)
01:27:05FromDiscord<albassort> beef do you know about AES
01:27:12FromDiscord<albassort> or any of you
01:28:54FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=VuzoLTBB
01:29:03FromDiscord<albassort> seems this is not expected?
01:48:35FromDiscord<ElegantBeef> In reply to @albassort "beef do you know": I know that they're 3 letters from the English alphabet
01:49:03FromDiscord<albassort> see Beef I like to believe that you know everything about everything im working with
01:49:09FromDiscord<albassort> but its that you know everything about nim
01:50:37FromDiscord<ElegantBeef> You are asking though "Is it expected for encryption to accept any key"
01:51:20FromDiscord<albassort> no i just didn't read the RFC or wikipedia because im stupid
01:51:34FromDiscord<albassort> CBC returns the first block of the IV in the first block of the response
01:51:55FromDiscord<ElegantBeef> No CBC is a crown owned Canadian broadcaster
01:52:19FromDiscord<albassort> beef i declared a cstring with let but these procedures are still mutatting it
01:52:21FromDiscord<albassort> (edit) "mutatting" => "mutating"
01:52:29FromDiscord<ElegantBeef> You're joking right?
01:52:34FromDiscord<albassort> no
01:52:36FromDiscord<albassort> :)
01:52:53FromDiscord<ElegantBeef> Now I don't know if to insult your or answer the question
01:52:59FromDiscord<ElegantBeef> (edit) "your" => "you"
01:53:30FromDiscord<albassort> I understand why but it shouldn't be happening
01:53:56FromDiscord<ElegantBeef> You're passing a cstring to something that expects it to be a mutable buffer
01:54:03FromDiscord<albassort> then make it var!
01:54:17FromDiscord<ElegantBeef> You're the one passing the cstring to a procedure that is mutating data
01:54:28FromDiscord<albassort> hey i didn't write this procedure
01:54:38FromDiscord<ElegantBeef> `let` and `var` only exist in Nim and you can override them using unsafe operations
01:55:24FromDiscord<albassort> why does nim runtime not have a check when passing it to and from a procedure that if the variable is of let it shouldn't be mutated when returned
01:55:38FromDiscord<ElegantBeef> Cause that is overhead for no reason
01:56:23FromDiscord<albassort> well then have it only run on -d:debug to dissuade people during development from doing this
01:57:06FromDiscord<ElegantBeef> I mean you should not have unsafe procedures exposed to the user
01:57:10FromDiscord<albassort> basically: I'm just mad that this procedure calls a c procedure but doesn't inform me the variable will be mutated
01:58:35FromDiscord<ElegantBeef> Well the procedure should likely take `var openArray[T]`
01:58:52FromDiscord<albassort> i mean yeah, its supposed to be generated from random bytes
01:59:17FromDiscord<albassort> i have to convert it manually to a cstring and no CSPRNG procedure will by default return a string
01:59:26FromDiscord<ElegantBeef> Also it's not like it's changing where the pointer points
01:59:34FromDiscord<ElegantBeef> It's just mutating the data at the ptr
02:00:30FromDiscord<albassort> it would be good form to tell me rather than me debugging for 10 minutes
02:00:50FromDiscord<ElegantBeef> Well Nim `let` does not effect data pointers point to
02:01:09FromDiscord<ElegantBeef> So even `let x = new int; x[] = 300` is valid
02:03:24FromDiscord<albassort> uhm actually thats a reference not a pointer
02:04:28*xet7 quit (Ping timeout: 268 seconds)
02:04:31FromDiscord<ElegantBeef> Literally the same thing
02:04:48*greatman joined #nim
02:16:48*xet7 joined #nim
02:19:50*greatman quit (Ping timeout: 250 seconds)
02:52:09FromDiscord<demotomohiro> In reply to @albassort "why does nim runtime": It is impossible to know if pointer type param of C function change data or not only from function signature.↵Only ways to know that is read manual carefully or read source code.
03:11:19FromDiscord<ElegantBeef> In reply to @demotomohiro "It is impossible to": Well you can always inject a check after each operation, but that of course stupid
03:19:01FromDiscord<albassort> regardless of practicality: the author of nimAES failed to inform me of the mutability of cstring provided into their functions
03:20:37FromDiscord<ElegantBeef> Well there are no docs for it 😄
03:21:26FromDiscord<albassort> there also an issue where if i reuse the initAES type in a loop, something mutates within it and it no longer does AES correctly
03:21:36FromDiscord<albassort> perhaps the author is just not very aware of mutability
03:22:31FromDiscord<riku5543> Can you post example code?
03:22:58FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=CIIydqIB
03:23:08FromDiscord<albassort> input string should be pretty long
03:23:17FromDiscord<albassort> i ported it over to a different file to make proper functions for database things
03:23:21FromDiscord<ElegantBeef> ` copyMem(iv, output, 16)` they clearly know about mutabillity
03:23:53FromDiscord<albassort> sorry the code is kinda insane and isorganized but i was debugging and im not currently fixing that
03:24:04FromDiscord<albassort> (edit) "isorganized" => "inorganized"
03:24:11FromDiscord<albassort> (edit) "inorganized" => "unorganized"
03:24:25FromDiscord<riku5543> Idk anything about the aes library but shouldn't init only be called one time?
03:24:41FromDiscord<albassort> In reply to @albassort "there also an issue": .
03:24:53FromDiscord<albassort> if you don't do that the decrypt doesn't work
03:24:58FromDiscord<albassort> returns noise
03:39:13FromDiscord<riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=fpyMwPPl
03:42:10*krux02 quit (Remote host closed the connection)
03:46:29FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=rpXUiAuP
03:46:58FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1250657641752166410/message.txt?ex=666bbd31&is=666a6bb1&hm=d837b3aad9c01e37a9e6d34c37e9097b3455f479480a369e8d272831270cb867&
03:47:05FromDiscord<albassort> heres a real world example
03:47:29FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=WsTQVwDT
03:47:45FromDiscord<albassort> (no that private key is mine)
03:47:49FromDiscord<albassort> (edit) "(no that private key is ... mine)" added "not"
03:48:43FromDiscord<riku5543> What's the expected output?
03:48:55FromDiscord<albassort> the output is the same as the input
03:49:04FromDiscord<albassort> with the code i posted earlier it works fine
03:49:16FromDiscord<albassort> but it sets the decode and encode every loop and inits it
03:49:43FromDiscord<albassort> this one sets it 1 time, and it outputs noise
04:02:04FromDiscord<riku5543> I tinkered with it a bit but can't get it to output the input string. I don't know the libraries well enough to help, sorry.
04:02:27FromDiscord<albassort> Oh i didn't need help, I was explaining that this issue exists
04:04:12FromDiscord<morgan> so im getting back to the nim bgfx idl code gen thing, and thinking more about enums for bitfields
04:05:09FromDiscord<morgan> is there a way i could set up an operator to do like ord(a) or ord(b) of any int or enum, like one definition?
04:05:16FromDiscord<morgan> (edit) "ord(a)" => "`ord(a)" | "ord(b)" => "ord(b)`"
04:05:25*coldfeet joined #nim
04:08:48FromDiscord<morgan> or i guess i'll just stick with my previous solution
04:09:54FromDiscord<morgan> tho it means i have to do a bit more work to get the predefined combined options available
04:10:00FromDiscord<morgan> or not make them available
04:10:17FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#pasty=aViiBvBt
04:14:02FromDiscord<riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=TnZPQmHw
04:15:08FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#pasty=MuiXGiRb
04:15:24FromDiscord<riku5543> Ah nice :3
04:15:28FromDiscord<riku5543> (edit) removed ":3"
04:15:34FromDiscord<morgan> except i will need to change that to manually set values
04:16:04FromDiscord<morgan> since for example, the depth/z value in that bit field i posted is like at bit 37 or 38 or something lol
04:17:14FromDiscord<morgan> also i have a bit of pain to deal with since it splits up them into multiple entries in that table at various offsets, which as ints wouldn't be an issue but i'll have to combine them
04:17:18FromDiscord<morgan> in lua 💀
04:17:41FromDiscord<morgan> (i have to do this in lua, it has been much more pain than it would've been in nim)
04:18:14FromDiscord<ElegantBeef> You can just `cast[uint32](yourSet)`
04:19:18FromDiscord<morgan> that's the same as ord, right?
04:19:45FromDiscord<ElegantBeef> No cause it's a set[enum] -> uint32
04:21:21FromDiscord<morgan> oh that converts the set to an int
04:21:28FromDiscord<morgan> interesting
05:46:57*ntat joined #nim
05:47:38*coldfeet quit (Remote host closed the connection)
06:37:09*PMunch joined #nim
07:00:42*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
07:04:06*Lord_Nightmare joined #nim
07:19:24*ntat quit (Quit: Leaving)
07:47:49*redj quit (Quit: No Ping reply in 180 seconds.)
07:49:11*redj joined #nim
09:06:16*fallback quit (Ping timeout: 268 seconds)
09:47:57*beholders_eye joined #nim
10:03:26*beholders_eye quit (Ping timeout: 256 seconds)
11:22:46*krux02 joined #nim
11:28:27FromDiscord<Robyn [She/Her]> In reply to @morganalyssa "is there a way": Why not just use a set?
12:07:53*fallback joined #nim
12:14:58FromDiscord<sOkam! 🫐> In reply to @morganalyssa "oh that converts the": what beef mentioned is compatible with C btw. if you pass `set[SomeEnum]` to a C `int` or `uint`, it will work perfectly fine↵_eg: in an `importc` function_
12:15:19FromDiscord<sOkam! 🫐> (edit) "btw. if" => "btw↵if"
12:25:11*ntat joined #nim
12:32:18PMunchOh fuck me..
12:32:34PMunchI've been struggling with some embedded Nim code, translated from C code
12:32:39PMunchFor weeks!
12:34:28PMunchI was doing iteration the C way with pointer arithmetic, and I had `inc(cast[var uint32](thePointer), thePointer.length)`. Pretty sure that came from c2nim (because who else writes inc like that..). Turns out, instead of moving the pointer it was editing the memory
12:56:33FromDiscord<sOkam! 🫐> In reply to @PMunch "I was doing iteration": sounds like a nasty/tough one to find↵that snippet does look like you would move the pointer indeed 🤔↵why was it not?
12:57:03*xet7 quit (Quit: Leaving)
12:58:20FromDiscord<pmunch> It was updating the value in memory
12:58:35FromDiscord<pmunch> Not the pointer itself
12:59:12FromDiscord<pmunch> I guess `var uint32` turns into `ptr uint32` under the hood, and since `thePointer` is a pointer it just wrote to whatever was in that location.
12:59:43FromDiscord<pmunch> The `length` field was at offset 0, so it just kept doubling the length until it reached the given max length of the data
13:03:49FromDiscord<sOkam! 🫐> oh! right because you added `var`. interesting↵I would have thought that meant `modifiable` in C... but I guess nim's var is different 🤷‍♂️
13:31:43*coldfeet joined #nim
13:33:33*ntat_ joined #nim
13:34:27*ntat quit (Ping timeout: 264 seconds)
13:40:24FromDiscord<albassort> do i need to dalloc cstrings
13:40:36FromDiscord<albassort> if a cstring is created in a ffi function do i need to worry about it
13:41:47FromDiscord<Phil> In reply to @albassort "if a cstring is": I don't know what that sentence means.↵Like, a lib hands you a string, do you need to deallocate that string?
13:41:51FromDiscord<Phil> (edit) "lib" => "C-lib"
13:42:17FromDiscord<albassort> will ARC remove it or if it leaves the scope will it be a stale value
13:42:22FromDiscord<albassort> will they memory leak
13:42:34FromDiscord<ieltan> yeah it will leak if it was malloc'ed
13:42:38FromDiscord<Phil> In reply to @albassort "will ARC remove it": If a lib hands you a cstring aka a pointer you need to clean that up
13:42:46FromDiscord<Phil> Assuming you get ownership
13:42:55FromDiscord<ieltan> basically
13:42:56FromDiscord<Phil> That should be documented by the lib if it expects you to "deallocate" or not
13:43:04FromDiscord<albassort> im the one writing the lib
13:43:06FromDiscord<albassort> 😠
13:43:08FromDiscord<Phil> If you deallocate, the library must provide a deallocation function, you never manually allocate yourself
13:43:16FromDiscord<Phil> (edit) "allocate" => "deallocate"
13:43:23FromDiscord<Phil> Because you can't make assumption about which allocator the lib used
13:43:56FromDiscord<Phil> In that case hand them pointers and don't expect ARC to do jack
13:44:00FromDiscord<albassort> well, it used the rust-c-ffi allocator for creating c-pointers that survive outside the scope of rust
13:44:13FromDiscord<ieltan> In reply to @albassort "im the one writing": if you have control then it's basically up to you how you wanna manage ownership/lifetimes
13:44:24FromDiscord<albassort> the problem is idk how rust works
13:44:46FromDiscord<albassort> if it was C I know it used malloc, its on the heap of the thread it was created on
13:44:49FromDiscord<Phil> In reply to @ieltan "if you have control": For compatibility I think just handing out pointers and letting them call your deallocation function is the way to go, no?↵Can't think of any other way that would work cross language
13:44:53*beholders_eye joined #nim
13:45:14FromDiscord<exelotl> In reply to @PMunch "I was doing iteration": wow... I didn't know you could use `var` like that 😅
13:45:14FromDiscord<Phil> Because you can't know when they are done with the value you gave them
13:45:34FromDiscord<ieltan> In reply to @albassort "well, it used the": i dont know either, if this is anything like Nim's `create` then be careful, you'll have to use the Rust api to free it afterwards
13:46:08FromDiscord<albassort> well rust has scope, it doesn't matter, only the C pointers i create might have issues. But nim owns all of them
13:46:16FromDiscord<albassort> alright next question
13:46:22FromDiscord<albassort> if i create a cstring do i need to dalloc that too?
13:47:10FromDiscord<pmunch> In reply to @exelotl "wow... I didn't know": I mean it didn't work.. At least not the way I expected it to
13:47:55FromDiscord<ieltan> allocators typically mmap big chunks of memory and hands you over a raw pointer to it business as usual but you have to use the same allocator's api to free it then
13:48:00FromDiscord<ieltan> @albassort
13:48:19FromDiscord<albassort> i meant create a cstring like this
13:48:33FromDiscord<ieltan> (edit) "it" => "a specific part of it, "
13:48:43FromDiscord<demotomohiro> In reply to @albassort "do i need to": It depends on how the memory `cstring` points to is created.↵If it is allocated with a function that allocate heap, you need to call corresponding function that deallocate the heap.↵If it points to data segment, you dont need to do anything.
13:48:50FromDiscord<exelotl> it sorta makes sense - `var` is a hidden pointer that gets auto-dereferenced. I guess I'm most surprised that it worked without {.experimental: views.}
13:48:53FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=yaKetNVc
13:49:09FromDiscord<albassort> (edit) "https://play.nim-lang.org/#pasty=NNLWDXyA" => "https://play.nim-lang.org/#pasty=bSmfPVvX"
13:49:37FromDiscord<pmunch> You don't have to free that one
13:49:41FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=ZmerGiuk
13:49:49FromDiscord<pmunch> It will get freed automatically when `foo` goes out of scope
13:50:07FromDiscord<ieltan> In reply to @isofruit "For compatibility I think": yup, keepin' it stupid simple
13:50:37FromDiscord<Phil> In reply to @ieltan "yup, keepin' it stupid": I like stupid code
13:50:40FromDiscord<Phil> Stupid code is on my level
13:50:41FromDiscord<albassort> alright so since the only way that the char i create in rust can exist is as a pointer to a memory block on the heap, with no basis in nim, I do need to free those
13:50:56FromDiscord<albassort> 👍
13:51:34FromDiscord<albassort> the world if C used Pascal Strings:↵futurewithflyingcars.jpg
13:53:37PMunchPascal strings?
13:54:25FromDiscord<albassort> In reply to @PMunch "Pascal strings?": what nim has
13:54:57FromDiscord<albassort> in memory it looks like ↵length : uint(x)↵data
13:55:23PMunchSo not like a Nim string..
13:55:31FromDiscord<albassort> well, same concept
13:55:36PMunchSure
13:55:36FromDiscord<albassort> length then data
14:04:10FromDiscord<ieltan> In reply to @isofruit "I like stupid code": talking about stupid code, i realise `cstring` can be used to stack allocate strings like in C but it's such a pain in the ass to do so in Nim
14:04:29FromDiscord<Phil> ?
14:04:48FromDiscord<Phil> Is creating cstrings that painful?
14:08:22FromDiscord<ieltan> more like unfortunate
14:08:33FromDiscord<ieltan> `let arr = ['h', 'e', 'l', 'l', 'o', '\n'].addr.cstring` doesn't work
14:09:34FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#pasty=ItwlQbQR
14:09:47FromDiscord<ieltan> hmm
14:09:54FromDiscord<ieltan> maybe i'm just stupid myself
14:11:13FromDiscord<Robyn [She/Her]> In reply to @ieltan "more like unfortunate": Have you tried `[0].addr`?
14:11:35*beholders_eye quit (Ping timeout: 256 seconds)
14:12:00FromDiscord<Robyn [She/Her]> Also wait I'm pretty sure you can't get a pointer to something that isn't actually stored in a variable/constant/let
14:12:27FromDiscord<Robyn [She/Her]> That's reasonable to me
14:12:47FromDiscord<Robyn [She/Her]> Can't get a pointer to a variable if there is no variable
14:12:51*PMunch quit (Quit: Leaving)
14:13:21FromDiscord<ieltan> yeah im stupud
14:13:27FromDiscord<ieltan> `let str = "something".cstring`
14:13:31FromDiscord<ieltan> lol
14:13:40FromDiscord<ieltan> sometime i think too much in c
14:14:07FromDiscord<ieltan> i need to get my head out of this pointer everything mindset
14:15:28FromDiscord<Robyn [She/Her]> "Not everything has a pointer, but a pointer can have anything"
14:16:57FromDiscord<ieltan> wait
14:18:50FromDiscord<ieltan> ughughughu
14:19:18FromDiscord<ieltan> now im not sure because i dont know how literals works in nim
14:20:18FromDiscord<ieltan> what actually happens when i do `let x = cstring("somelit")`
14:20:21FromDiscord<ieltan> ?
14:22:37FromDiscord<Robyn [She/Her]> In reply to @ieltan "what actually happens when": Why not check in the generated C source?
14:22:54FromDiscord<Robyn [She/Her]> Just add `--nimcache:cache` to the compile flag
14:24:26FromDiscord<ieltan> In reply to @chronos.vitaqua "Just add `--nimcache:cache` to": i'll do that later, thanks for the tip
14:24:42FromDiscord<Robyn [She/Her]> No sweat!
14:26:54*disso-peach joined #nim
14:33:56*ntat_ quit (Quit: Leaving)
14:34:14*ntat joined #nim
15:38:03FromDiscord<srabb> which is the best vscode extension for nim
15:38:18FromDiscord<srabb> out of the first three that i see
15:43:08FromDiscord<fabric.input_output> nim.nvim
15:44:24*beholders_eye joined #nim
15:44:28FromDiscord<morgan> In reply to @heysokam "what beef mentioned is": oh neat. my guess is that’s still limited to only values of one enum, right? for some reason the high level interface definition splits up some bitfields into multiple sub-types, which of course would not be an issue if it was just ints or’d together
15:47:13FromDiscord<sOkam! 🫐> In reply to @morganalyssa "oh neat. my guess": enum sets are just bits or'ed together
15:48:05FromDiscord<morgan> yeah but like can i do that with values from several different enums
15:48:43FromDiscord<sOkam! 🫐> you would be going out of the typesystem in that case, so yeah definitely not compatible between enums
15:48:58FromDiscord<sOkam! 🫐> enums values in C (well almost evreything really) is hella unsafe
15:49:02FromDiscord<sOkam! 🫐> (edit) "evreything" => "everything"
15:49:04FromDiscord<morgan> that’s what i thought
15:49:44FromDiscord<sOkam! 🫐> I'd argue if you need to mix flag-sets... you are doing something super wrong. but that might just be my hyper-strict-compiler brain
15:49:55FromDiscord<morgan> it’s like 60 options spread over like 10ish types for some reason, in the high level interface description
15:50:12FromDiscord<morgan> rather than defining each bit in one thing
15:50:27FromDiscord<sOkam! 🫐> ic. classic C chaos, it seems
15:51:10FromDiscord<morgan> so either i try to figure out what goes together, like is it just this one or other groups, to put it all into one, or use a solution that takes that into account
15:51:51FromDiscord<morgan> it probably does include other groups like that
15:53:43FromDiscord<morgan> extra chaos because for some reason, instead of making a c and c++ version with extern c in a .h, it has its own code generator that includes the source and generates the definitions for whichever one
15:56:23*krux02_ joined #nim
15:58:07FromDiscord<sOkam! 🫐> classic C chaotic ordering, indeed
15:58:53*krux02 quit (Ping timeout: 240 seconds)
16:16:09FromDiscord<sOkam! 🫐> how can I create a valid `nkDo` or `nnkDo` through code, without using the NimNode functions to create it?
16:16:25FromDiscord<sOkam! 🫐> something that if I parse it, I would get a `nkDo`
16:16:59FromDiscord<fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=arVRBxxB
16:17:11FromDiscord<fabric.input_output> the `do:` is going to get parsed as a `nnkDo` iirc
16:17:32FromDiscord<fabric.input_output> (edit) "a" => "an"
16:18:43FromDiscord<fabric.input_output> @sOkam! 🫐 is this what you wanted?
16:19:54FromDiscord<sOkam! 🫐> idk, let me try it ✍️
16:22:45FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=oYXeTahU
16:23:13FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=qbPWsaGg
16:23:21FromDiscord<Robyn [She/Her]> Iirc do is just transformed to a stmt list
16:23:33FromDiscord<Robyn [She/Her]> Like, always
16:23:45FromDiscord<Robyn [She/Her]> Have you checked in the compiler code?
16:23:53FromDiscord<fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=ntoqBaOS
16:24:01FromDiscord<fabric.input_output> nvm I'll try it
16:24:10FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "Have you checked in": figured I should ask before wasting a few hours of my time digging there 🙈 never gone well when i tried that route
16:24:44FromDiscord<Robyn [She/Her]> In reply to @heysokam "figured I should ask": Fair
16:24:54FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=MDrVCHqV
16:25:13FromDiscord<Robyn [She/Her]> Oh nice
16:26:12FromDiscord<fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=TlPNIUrP
16:27:55FromDiscord<sOkam! 🫐> doesn't sound like I can use it for creating `do { BODY } while (CONDITION);` though 😦
16:28:41FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=zzGYMtnZ
16:30:00FromDiscord<fabric.input_output> In reply to @heysokam "what is it about": the function signature thingy between `do` and `:`
16:30:08FromDiscord<fabric.input_output> it's syntax sugar for higher order functions
16:31:34FromDiscord<threefour> Does anyone know of an IPP library for Nim?
16:31:49FromDiscord<fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=UmeIWSNW
16:32:04FromDiscord<fabric.input_output> (edit) "https://play.nim-lang.org/#pasty=VNFypvsp" => "https://play.nim-lang.org/#pasty=oQjphPZb"
16:32:26FromDiscord<sOkam! 🫐> oh i see
16:36:11FromDiscord<fabric.input_output> chat is this real https://media.discordapp.net/attachments/371759389889003532/1250851219887624273/image.png?ex=666c717a&is=666b1ffa&hm=022ffe3c2dcdc6fbc6fc69abae71579df35ef8d3b1e87578377c25ba753068f6&
16:36:16FromDiscord<fabric.input_output> (about nim)
16:36:34FromDiscord<fabric.input_output> I'm trying to understand how the dispatch tree mechanism works
16:51:31FromDiscord<Robyn [She/Her]> I thought Nim didn't use VTables? Maybe that changed in Nim 2.0
16:52:33*xet7 joined #nim
16:52:54*xet7 quit (Remote host closed the connection)
16:53:24*xet7 joined #nim
16:57:32FromDiscord<fabric.input_output> idk, wikipedia could be wrong
17:03:12FromDiscord<fabric.input_output> I'm trying to make a widget system here and I'm wondering if using `method` will be more overhead than passing an object with function pointers
17:03:30FromDiscord<Robyn [She/Her]> Does anyone know how I'd define sane ratelimits for my API or nah?
17:04:43FromDiscord<fabric.input_output> In reply to @chronos.vitaqua "Does anyone know how": threading, async or plain old single thread?
17:05:42FromDiscord<Robyn [She/Her]> It's threading but that's not the issue, I meant how do I decide how many requests at a time to throttle after
17:06:15FromDiscord<fabric.input_output> In reply to @chronos.vitaqua "It's threading but that's": make a central object which every thread asks for making requests. if the ratelimit time has not passed it simply blocks
17:07:09FromDiscord<fabric.input_output> a mutex, a uint64 and a function is all you need tbh
17:07:26FromDiscord<fabric.input_output> mutex or lock idk the exact terminology
17:07:30FromDiscord<Robyn [She/Her]> Still not my question aha, I'm asking how do I decide the time, specifically
17:07:36FromDiscord<fabric.input_output> ah
17:07:50FromDiscord<fabric.input_output> see if the website says something about rate limits?
17:07:59FromDiscord<Robyn [She/Her]> It's for my own server
17:08:46FromDiscord<fabric.input_output> hmm
17:09:45FromDiscord<fabric.input_output> maybe check and benchmark how many requests at a time your server can handle and go from there?
17:10:34FromDiscord<Robyn [She/Her]> Still doesn't seem wise to allow 100 requests to create an account at once tbh
17:11:43FromDiscord<fabric.input_output> for account creation, maybe limit it to 5 seconds/request
17:12:35*beholders_eye quit (Ping timeout: 264 seconds)
17:13:44FromDiscord<fabric.input_output> just pick an arbitrary number that seems reasonable I'd say
17:15:01FromDiscord<Robyn [She/Her]> Fair enough
17:28:25*xet7 quit (Quit: Leaving)
17:32:17*xet7 joined #nim
18:04:07*rockcavera quit (Read error: Connection reset by peer)
18:11:30*rockcavera joined #nim
18:35:00FromDiscord<xkonti> Is somebody here using Neovim to write Nim? I wonder if it's support for Nim (autocomplete, error detection, etc) is less sluggish and crashy than in VSCode.
18:48:46FromDiscord<Robyn [She/Her]> How hard is it to get a basic email server that can only send messages, working?
18:49:06FromDiscord<Robyn [She/Her]> And how would I test it without a domain name? Send it to a local email server?
18:54:26Amun-Raxkonti: it's as stable as nimsuggest
19:07:41FromDiscord<xkonti> In reply to @Amun-Ra "<@244832576215318528>: it's as stable": :/ That's too bad. The moment I extract code to a separate file it all goes wonky and it often takes 15+ seconds after code changes (file save) for it to figure out the type changes, etc.↵↵Kind of makes me want to abandon Nim out of frustration 😦
19:08:57Amun-Raoften it works like a charm, other times nimsuggest leaves a core file
19:11:15Amun-Ra"nimsuggest instance for project /home/amun/nim/ronin/src stopped with exitcode: 139"
19:12:27Amun-RaI had to move core generation to /tmp not to kill my nvme ;)
19:17:01*ntat quit (Quit: Leaving)
19:20:40FromDiscord<fabric.input_output> In reply to @xkonti "Is somebody here using": I'm using it but only with `nim.nvim` which just does semantic highlighting. works
19:21:43Amun-Rasame, nim.nvim
19:24:42FromDiscord<.alea.> sent a code paste, see https://play.nim-lang.org/#pasty=ZeNqJJyV
19:25:17FromDiscord<xkonti> In reply to @fabric.input_output "I'm using it but": Syntax highlighting is fine. I'm just looking for a setup that has actually working redlining with error messages, autocomplete and definition hints. Things that seem to be the base minimum standard in all other languages I dealt with before. I'm a dev that's used to tools like Rider, WebStorm and Visual Studio 🤪
19:25:55Amun-Rawhat's conditional member name?
19:26:19Amun-Raah
19:26:25FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=LjMszIps
19:26:51FromDiscord<.alea.> so it is ok to just treat the names of struct member as variables
19:26:54FromDiscord<juancarlospaco> In reply to @xkonti "Syntax highlighting is fine.": Theoretically Jetbrains has an official plugin for Nim right in the builtin plugin list, I dunno how is it working now long time not used it.
19:26:59FromDiscord<.alea.> (edit) "member" => "members"
19:27:34FromDiscord<xkonti> In reply to @juancarlospaco "Theoretically Jetbrains has an": It's just syntax highlighting as far as I tested it...
19:29:09FromDiscord<juancarlospaco> In reply to @.alea. "so it is ok": Iff it is mutable you can assign to it.
19:29:32FromDiscord<bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=NrZYywgQ
19:29:34FromDiscord<juancarlospaco> (edit) "assign" => "assign/re-assign"
19:29:47FromDiscord<.alea.> sent a code paste, see https://play.nim-lang.org/#pasty=dQFgSiSq
19:30:14FromDiscord<.alea.> is there any way to make nim treat 'x' like a name
19:30:28FromDiscord<.alea.> like a macro or something?
19:30:51FromDiscord<juancarlospaco> But condMember is not a field of Test.
19:31:12FromDiscord<.alea.> basically I guess I want a macro to replace condMember with x
19:31:47FromDiscord<bosinski2023> In reply to @.alea. "basically I guess I": yep, you need a macro for that..
19:32:38FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=DEBJDGQA
19:35:39FromDiscord<juancarlospaco> In reply to @xkonti ":/ That's too bad.": Weird (but possible) it takes that time to recompile, I wonder if you doing something computationally heavy way without knowing. 😥
19:40:02FromDiscord<nervecenter> Can anyone tell me why symbols defined in a modules top level are going out of scope for template procedures in that module? I just modified them so they can take similar but different types in certain parameters (using `|`), and now all the top-level symbols are throwing errors in the templates and are supposedly out of scope.
19:40:19FromDiscord<nervecenter> (edit) "modules" => "module's"
19:40:38FromDiscord<nervecenter> (edit) "them" => "normal procedures into templates"
19:41:02FromDiscord<bosinski2023> @Alea at the end here https://forum.nim-lang.org/t/4573#28714 allows for obj["x"] .. there are other macros around - search the forum..
19:44:23FromDiscord<.alea.> In reply to @bosinski2023 "@Alea at the end": That looks pretty good! I'll have to investigate down that route
19:50:30FromDiscord<juancarlospaco> In reply to @nervecenter "Can anyone tell me": Theres no template procedures, they are different, different scoping etc.
19:50:58*xet7 quit (Quit: Leaving)
19:51:06FromDiscord<juancarlospaco> proc does take |
19:52:17FromDiscord<nervecenter> I've noticed that if I use `` to export the symbols the procs can see them again, but now symbols from imported modules have supposedly evaporated
19:52:24FromDiscord<nervecenter> This is confusing
19:53:23*coldfeet quit (Remote host closed the connection)
19:53:51FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=CWDtBNHW
19:54:02FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=FyslyhkC
19:54:24FromDiscord<Robyn [She/Her]> Even weirder, in my actual code, not the small example I made here, I got a generic instantiation error
19:58:12FromDiscord<juancarlospaco> In reply to @nervecenter "I've noticed that if": Only symbols with are visible from the outside.
19:59:17FromDiscord<nervecenter> These are procs in the SAME module as those symbols
19:59:34FromDiscord<nervecenter> Well, not the imported module symbols
20:00:05FromDiscord<nervecenter> What I'm saying is that a source file that used to work fine, now that the procs use `|` in the parameters, those procs can't see any symbols from the top level scope or from other modules anymore
20:00:08FromDiscord<nervecenter> They just broke completely
20:00:09FromDiscord<Robyn [She/Her]> In reply to @chronos.vitaqua "Even weirder, in my": Oh seems like I just need to manually cast it every time
20:00:19FromDiscord<Robyn [She/Her]> (edit) "cast" => "upcast"
20:03:29FromDiscord<ElegantBeef> In reply to @nervecenter "Can anyone tell me": "template procedures"?
20:03:30FromDiscord<nervecenter> Even the `[]` proc from `std/tables` is invisible from inside those procs now
20:03:55FromDiscord<nervecenter> In reply to @elegantbeef ""template procedures"?": What do you call procedures that use `|` to take multiple types for some parameters?
20:04:18FromDiscord<ElegantBeef> Generics
20:04:36FromDiscord<nervecenter> Se even if the types are constrained it's still called generic?
20:04:38FromDiscord<nervecenter> Alright then
20:04:42FromDiscord<nervecenter> (edit) "Se" => "So"
20:04:47FromDiscord<ElegantBeef> Yes
20:04:53FromDiscord<ElegantBeef> It's a typeclassed generic
20:05:03FromDiscord<ElegantBeef> You're likely hitting a binding issue
20:05:15FromDiscord<nervecenter> Well, procs that were previously not generic are now generic and have lost the ability to see top-level symbols in their module or imported modules
20:05:23FromDiscord<ElegantBeef> If you can share the procedure definition and usage that'd help
20:05:37FromDiscord<nervecenter> I need to edit it down
20:07:00FromDiscord<nervecenter> Actually that's going to be virtually impossible, these are not small procedures
20:07:11FromDiscord<nervecenter> And I can't share proprietary stuff here
20:07:23FromDiscord<ElegantBeef> Well put `bind symbolName` inside the generic
20:08:22FromDiscord<nervecenter> I see
20:10:09FromDiscord<ElegantBeef> In theory you never need `bind`, but sometimes generic symbols are funky
20:27:47FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=yvpcrcHp
20:27:50FromDiscord<Robyn [She/Her]> Odd...
20:28:21FromDiscord<Robyn [She/Her]> `proc isUnsealedImpl(provider: Repository): bool = SQLiteRepository(provider).db.isOpen`↵That's the snippet on the line
20:33:30FromDiscord<Robyn [She/Her]> Do I need to forcefully cast it? :/
20:34:56*xet7 joined #nim
20:35:18FromDiscord<fabric.input_output> In reply to @chronos.vitaqua "Do I need to": Repository has no inheritance connection with SQLiteRepository it seems?
20:35:48FromDiscord<thomasnh> sent a long message, see https://pasty.ee/QwFanwfJ
20:36:00FromDiscord<fabric.input_output> In reply to @chronos.vitaqua "Do I need to": try to softly cast (aka convert)
20:36:09FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=wLgGOxPP
20:36:37FromDiscord<fabric.input_output> In reply to @chronos.vitaqua "It does though, according": yeah you need to cast it to the appropriate type, had an issue like this recently.
20:36:57FromDiscord<fabric.input_output> not with `cast`
20:36:58FromDiscord<Robyn [She/Her]> In reply to @chronos.vitaqua "`proc isUnsealedImpl(provider: Repository): bool": That's what I did here
20:37:07FromDiscord<Robyn [She/Her]> That's a normal conversion
20:38:44FromDiscord<fabric.input_output> odd
20:39:39FromDiscord<Robyn [She/Her]> Yeah, my thoughts exactly
20:40:16FromDiscord<fabric.input_output> how many overloads of `isUnsealedImpl` are there?
20:40:45FromDiscord<ElegantBeef> `proc(_: Child)` is not convertible to `proc(_: Parent)`
20:40:50FromDiscord<fabric.input_output> maybe you are getting the wrong one? have you tried not to cast it before calling it?
20:40:50FromDiscord<Robyn [She/Her]> In reply to @fabric.input_output "how many overloads of": Just the one
20:40:57FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "`proc(_: Child)` is not": Wdym?
20:41:01FromDiscord<ElegantBeef> For your first issue
20:41:12FromDiscord<ElegantBeef> `(proc(r: SQLiteRepository): bool)isUnsealedImpl` this is not valid
20:41:17FromDiscord<fabric.input_output> In reply to @chronos.vitaqua "Just the one": you did `isUnsealedImpl(repo.Repository)` right?
20:41:23FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "`(proc(r: SQLiteRepository): bool)isUnsealedImpl` t": Ah yeah I fixed that
20:41:56FromDiscord<Robyn [She/Her]> In reply to @fabric.input_output "you did `isUnsealedImpl(repo.Repository)` right?": That's in another file
20:42:07FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#pasty=xYGnfStm
20:42:19FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "What's this line?": It's the code I sent below
20:42:58FromDiscord<Robyn [She/Her]> `SQLiteRepository` inherits from `Repository` so that shouldn't be an issue
20:43:15FromDiscord<fabric.input_output> no you have to cast to the appropriate type
20:43:40FromDiscord<ElegantBeef> https://play.nim-lang.org/#pasty=OKYtyHwN
20:43:42FromDiscord<ElegantBeef> Works fine
20:43:55FromDiscord<Robyn [She/Her]> In reply to @fabric.input_output "no you have to": What do you mean?
20:44:03FromDiscord<ElegantBeef> In reply to @thomasnh "Hey Been": It's not a hurdle, it literally does not matter
20:44:17FromDiscord<ElegantBeef> If you write well written C# you already do indention significant code
20:44:46FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "Works fine": That's why I'm so confused, a minimal example works but the full code doesn't
20:45:16FromDiscord<ElegantBeef> Well provide a reproduction of the issue
20:46:20FromDiscord<Robyn [She/Her]> sent a long message, see https://pasty.ee/FsnSAJCu
20:46:34FromDiscord<Robyn [She/Her]> When trimmed down, it works perfectly
20:46:43FromDiscord<fabric.input_output> In reply to @chronos.vitaqua "What do you mean?": I think you have to cast to the type the proc uses, even if the types have a sup/sub relationship
20:47:24FromDiscord<Robyn [She/Her]> In reply to @fabric.input_output "I think you have": That seems stupid and doesn't make sense to me
20:47:26FromDiscord<ElegantBeef> `obj: ref object`
20:47:28FromDiscord<fabric.input_output> or is it that you can cast to a parent but not to a child?
20:47:32FromDiscord<ElegantBeef> You're using implicit generics
20:47:45FromDiscord<ElegantBeef> `obj: typedesc[ref object]` you're using generics even further
20:48:13FromDiscord<ElegantBeef> You are attempting to make `Repository` generic, but give it no generic parameters
20:49:35FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "You are attempting to": I can't exactly give the type a generic parameter though, it defeats the purpose of the type
20:49:46FromDiscord<ElegantBeef> Well you have an unrepresentable type
20:49:49FromDiscord<Robyn [She/Her]> And iirc you can't store a `proc[T](t: T)`
20:49:50FromDiscord<ElegantBeef> `seq[ref object]` is nto valid
20:49:54FromDiscord<ElegantBeef> not
20:50:06FromDiscord<Robyn [She/Her]> That's great, then :/
20:50:16FromDiscord<Robyn [She/Her]> Would methods work here, then?
20:50:24FromDiscord<ElegantBeef> No cause the same issue appears
20:50:33FromDiscord<ElegantBeef> You need a method for each type you want to `deposit`
20:50:42*xet7 quit (Remote host closed the connection)
20:50:46FromDiscord<Robyn [She/Her]> Because I can't have generic methods?
20:50:48FromDiscord<ElegantBeef> Procs work just fine here if you make a serialization protocol
20:50:59FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "Procs work just fine": Oh? How would that work?
20:51:12FromDiscord<ElegantBeef> You make a proc for each atom then make a generic wrapper for higherlevel wrappings
20:51:24FromDiscord<Robyn [She/Her]> I don't get it
20:51:33FromDiscord<ElegantBeef> `depositInt, depostFloat, depositString, depositBleh` ....
20:51:53FromDiscord<ElegantBeef> Then you have a `proc deposit(repo: Repository, value: auto)`
20:51:59FromDiscord<ElegantBeef> And deposit all the parts of `value`
20:52:28FromDiscord<Robyn [She/Her]> By doing `for field in typ.fields`?
20:53:05FromDiscord<ElegantBeef> Sure
20:53:46FromDiscord<Robyn [She/Her]> Honestly I might just go back to my original way of doing this
20:54:30FromDiscord<Robyn [She/Her]> My original way used static dispatch and worked fine, I just wanted to be able to change the database at launch instead of at compile time
20:55:02FromDiscord<ElegantBeef> Just wrap your types in an object variant and call it a day
20:56:02FromDiscord<Robyn [She/Her]> That'd work probably
21:19:28FromDiscord<Robyn [She/Her]> It does indeed work :>
21:33:37FromDiscord<Robyn [She/Her]> Is `cast[uint64](mySet)` portable or do I need to account for endianness?
21:35:11FromDiscord<Robyn [She/Her]> Do you know, Beef? You're the one who suggested casting sets to an integer :p I wanna check if it's portable between machines, or if I need to account for endianness myself
21:36:26FromDiscord<Robyn [She/Her]> Oh, and also if in the future I decide to add another value to the enum definition, does that break the stored set, even though I appended the new value to the end?
21:36:34FromDiscord<Robyn [She/Her]> @ElegantBeef because you're using Discord here more
21:48:07FromDiscord<ElegantBeef> More like the bridge is down 😛
21:48:40FromDiscord<ElegantBeef> In reply to @chronos.vitaqua "Oh, and also if": As long as the size of the set does not change
22:00:53FromDiscord<Robyn [She/Her]> What's a sane maximum required password length for accounts?
22:02:04FromDiscord<Robyn [She/Her]> Typical max is 128, seems fine to me
22:02:41FromDiscord<ElegantBeef> 64 or 128 is fine for unsalted unhashed password
22:03:42FromDiscord<ElegantBeef> I know a lot of sites limit to 32 characters
22:04:20FromDiscord<zumi.dxy> "password too strong"
22:11:56FromDiscord<Robyn [She/Her]> Lol
22:14:24FromDiscord<that_dude.> The length really doesn't matter if you hash it right?
22:14:42FromDiscord<that_dude.> Ig you could make a ddos argument
22:14:42FromDiscord<fabric.input_output> salt and pepper your password
22:15:08FromDiscord<that_dude.> But hashing should be done client side anyways
22:15:12FromDiscord<fabric.input_output> password peppering is a real thing btw
22:16:56FromDiscord<Robyn [She/Her]> In reply to @that_dude. "The length really doesn't": True ig
22:17:11FromDiscord<Robyn [She/Her]> In reply to @fabric.input_output "salt and pepper your": I'm just using argon2 to hash it :p
22:17:35FromDiscord<Robyn [She/Her]> In reply to @that_dude. "But hashing should be": How would the server guarantee the client hashed it though?
22:24:13FromDiscord<that_dude.> Because the password field gets replaced by a hash field in the web requests. And then make sure that you only ever receive hashes in the way you Design the ui. It would stop someone from hand crafting their own login/password hashes or just setting the "hash" string to a text value, but that would be one the user for fucking with your ui
22:25:11FromDiscord<ElegantBeef> Alternative frontends would have to hash the password, but you would know if the length of the password is not the size of your hash
22:25:25FromDiscord<Robyn [She/Her]> Fair
22:25:38FromDiscord<Robyn [She/Her]> I might offload the hashing to clients then
22:26:20FromDiscord<that_dude.> Iirc pepper is basically a server side secret salt that you can use to further add a layer of complexity.
22:27:05FromDiscord<that_dude.> Unless your site is https only, it's def possible to read the password from intercepting the web requests
22:28:10FromDiscord<ElegantBeef> If your site is only http you have more problems
22:28:12FromDiscord<Robyn [She/Her]> In reply to @that_dude. "Unless your site is": How do you use the pepper though? Also isn't this point irrelevant since you need the client to send the password anyway for auth?
22:29:43FromDiscord<that_dude.> The client sends you the hash of their password. In your eyes it shouldn't matter if they send the original or hash as long as it's constant. By sending the hash instead of the raw password you avoid any network snooping or dangers that come from data base leaks
22:31:20FromDiscord<Robyn [She/Her]> How would I compare two argon2 hashes with eachother, then?
22:31:22FromDiscord<demotomohiro> In reply to @that_dude. "The client sends you": What if hacker steal the hash and used it to login?
22:32:05FromDiscord<that_dude.> As for pepper, if I understand it right, you take their hash, and do a secret mutation on the server side and then store the mutated one. You could just append a secret value to the hash for example. You should create an extra system that's easy to reverse engineer. Consider adding pepper(pulled from env or configure file) and hashing that result
22:32:39FromDiscord<that_dude.> In reply to @chronos.vitaqua "How would I compare": You just compare what they send you with what you have stored
22:33:20FromDiscord<that_dude.> In reply to @demotomohiro "What if hacker steal": That means they have the original password or your database got leaked. Tell them to change their password
22:33:51FromDiscord<that_dude.> Or have some form of tfa
22:33:54FromDiscord<that_dude.> 2fa
22:34:21FromDiscord<Robyn [She/Her]> Still don't get how them sending a hash is different from just sending their password if that's what is checked
22:35:27strogon14it's not
22:36:39FromDiscord<that_dude.> ^
22:37:10FromDiscord<demotomohiro> I thought client and server establish a secure connection and send password as is.↵Then, server hash it with salt and compare with the hash in database.↵Even if hacker steal the database, password is not leaked and cannot login.
22:37:27FromDiscord<kcvinker5420> Hi all, any article related to the use of Nim without GC ? I mean I would like to know the pitfalls and traps and things to notice when we use nim without GC.
22:37:35FromDiscord<ElegantBeef> You lose the stdlib
22:37:38FromDiscord<ElegantBeef> You lose exceptions
22:37:41FromDiscord<that_dude.> It just protects from more attack vectors. It also protects others from database leaks
22:37:41FromDiscord<ElegantBeef> You cannot use `string`
22:37:45FromDiscord<ElegantBeef> You cannot use `ref`
22:37:47FromDiscord<ElegantBeef> And so forth
22:38:12FromDiscord<kcvinker5420> So basically, I need to go back to the old C style, right ?
22:38:53FromDiscord<ElegantBeef> Yes, just use arc
22:39:16FromDiscord<ElegantBeef> You can do manual memory management but use arc and not lose the entire stdlib
22:39:28FromDiscord<ElegantBeef> Plus you do not have to manually manage resources
22:39:30FromDiscord<kcvinker5420> In reply to @elegantbeef "You can do manual": Is it ?
22:39:44FromDiscord<Robyn [She/Her]> In reply to @strogon14 "it's not": Ah okay then
22:39:45FromDiscord<that_dude.> In reply to @demotomohiro "I thought client and": That works too but is significantly more expensive VS just sending an Auth request to receive a bearer token. Otherwise you would need to go through the login mechanism every time you want to reconnect
22:39:45FromDiscord<ElegantBeef> Yes you can make your own data types using hooks
22:40:16FromDiscord<demotomohiro> If you dont use heap memory, you don't need manual memory management.
22:40:37FromDiscord<ElegantBeef> Even if you do use heap memory you do not need manual management 😛
22:40:42FromDiscord<kcvinker5420> In reply to @demotomohiro "If you dont use": I need to heap memory, since I am planning to make a dll
22:41:06FromDiscord<ElegantBeef> So why are you attempting to avoid the gc
22:41:57FromDiscord<kcvinker5420> In reply to @elegantbeef "So why are you": I think, when using objects from DLL, the proper way to handle memory is manual way.
22:42:15FromDiscord<kcvinker5420> Like, we determined destruction
22:42:16FromDiscord<ElegantBeef> Well sure, but you do not need to use manual memory management that way
22:42:28FromDiscord<kcvinker5420> Oh I see
22:42:38FromDiscord<kcvinker5420> Can you explain a little more please ?
22:42:42FromDiscord<ElegantBeef> You can use `--mm:arc` and give resources to the C ffi delaying ref counts
22:43:10FromDiscord<zumi.dxy> would there be any problems in using `orc` for shared libs?
22:43:16FromDiscord<ElegantBeef> No
22:44:07FromDiscord<ElegantBeef> You can do `GcRef(myRef)` to increment a ref count
22:44:25FromDiscord<ElegantBeef> Then you later can `GcUnref`
22:44:31FromDiscord<kcvinker5420> Oh, thats nice
22:44:50FromDiscord<ElegantBeef> Then you just pass your `ref` as a `T` in C-ABI
22:44:54FromDiscord<kcvinker5420> Just like manual memory management, but we are managing ref counts, right
22:45:21FromDiscord<ElegantBeef> Well yea you want to extend the ref count outside of the Nim dll
22:45:32FromDiscord<kcvinker5420> Yes, got it
22:45:58FromDiscord<kcvinker5420> What does `a` stands for in arc ?
22:46:03FromDiscord<ElegantBeef> automatic
22:46:12FromDiscord<kcvinker5420> Oh i see
22:46:26FromDiscord<kcvinker5420> But here we are doing manually
22:47:48FromDiscord<ElegantBeef> sent a code paste, see https://play.nim-lang.org/#pasty=hmZjkJjJ
22:48:36FromDiscord<ElegantBeef> It's that simple now you can do `intptr_t myInt = makeInt(); printf("%d\n", (myInt)); deleteInt(myInt);`
22:49:26FromDiscord<ElegantBeef> Though you want to use Nim with https://github.com/nim-lang/Nim/commit/716ff93161b4d4a02bd4a29860ddb9375e2fda5d if exposing across to cdecls
22:49:49FromDiscord<kcvinker5420> In reply to @elegantbeef "It's that simple now": This is pretty straight forward. Nice
22:49:53FromDiscord<ElegantBeef> Otherwise NRVO will kick in silently and you will have `makeInt(intptr_t result)`
22:50:16FromDiscord<Robyn [She/Her]> Yay, `orc` breaks everything in my code now :'D
22:50:18FromDiscord<ElegantBeef> Remember to compile with valgrind and ensure no leaks
22:50:29FromDiscord<kcvinker5420> What's NRVO ? Nim Runtime ....
22:50:31FromDiscord<Robyn [She/Her]> Specifically the teardown for my code
22:50:59FromDiscord<ElegantBeef> Return value optimization
22:51:16FromDiscord<kcvinker5420> In reply to @elegantbeef "Remember to compile with": I am planning to wrap the allocation code with some bookkeeping code
22:51:17FromDiscord<ElegantBeef> Don't recall what the N stands for
22:51:44FromDiscord<Robyn [She/Her]> `Nim`, smh
22:51:45FromDiscord<ElegantBeef> Ah "named"
22:52:20FromDiscord<kcvinker5420> Instead of using valgrind, what if we use a map to record the allocations ?
22:52:38FromDiscord<ElegantBeef> Why would you do that when you have valgrind?
22:52:44FromDiscord<ElegantBeef> <https://github.com/beef331/seeya> also might be of interest to you
22:53:05FromDiscord<ElegantBeef> <https://github.com/beef331/seeya/blob/master/tests/mylib.nim> generates <https://github.com/beef331/seeya/blob/master/tests/mylib.h>
22:55:57FromDiscord<kcvinker5420> It copies the comments!! That's s great tool
22:56:18FromDiscord<ElegantBeef> Would be greater if it was done by the compiler
22:56:52FromDiscord<kcvinker5420> Ha ha, yeah
23:03:52FromDiscord<kcvinker5420> There are compilers which does the same thing. There is a language called `C3`. It will generate c header files when you compile a dll file in it.
23:05:21FromDiscord<ElegantBeef> Yea, it'd be nice to get headers automatically generated from all exposed code and types
23:08:11FromDiscord<sOkam! 🫐> In reply to @xkonti "Is somebody here using": i am. using `nimls` and [`nim.vim`](https://github.com/heysokam/nim.vim) and it works great
23:08:52FromDiscord<sOkam! 🫐> I heard of treesitter being sluggish and also had that same experience myself. so im sticking with the syntax rules from vimscript old days
23:09:14FromDiscord<Robyn [She/Her]> Didn't Nim use to have header generation built-in?
23:09:27FromDiscord<ElegantBeef> It still does behind a flag that is not meant to be used nor is supported
23:12:01FromDiscord<ElegantBeef> It also is not very good
23:12:09FromDiscord<ElegantBeef> `N_LIB_IMPORT N_CDECL(void, doThing)(NI i_p0);`
23:19:29FromDiscord<Robyn [She/Her]> Ah
23:37:47FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=FLNRmkBa
23:38:09FromDiscord<ElegantBeef> You are not working on typed AST so you'll never see a sym
23:38:21FromDiscord<sOkam! 🫐> ah that's for sem? kk ty
23:39:11FromDiscord<sOkam! 🫐> I thought semantics didn't output `PNodes`, though, and it returned `NimNodes` instead
23:39:27FromDiscord<ElegantBeef> There are no such thing as NimNodes in the compiler
23:39:40FromDiscord<ElegantBeef> NimNodes are userfacing Pnodes
23:39:48FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "You are not working": Unless there's a macro API and sOkam supports std/macros smh
23:39:52FromDiscord<sOkam! 🫐> ah didn't know. makes sense
23:40:07FromDiscord<ElegantBeef> In reply to @chronos.vitaqua "Unless there's a macro": Except they have no semantic analysis so cannot call macros
23:40:09FromDiscord<Robyn [She/Her]> `genSym`
23:40:18FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "Unless there's a macro": metaprogramming in C sounds like ⚰️
23:40:24FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "Except they have no": Smh just implement manually
23:40:33FromDiscord<ElegantBeef> Well they always could make their own types
23:41:09FromDiscord<Robyn [She/Her]> In reply to @heysokam "metaprogramming in C sounds": If you use Nim's macros it'd probably be less hellish, instead of C's preprocessing
23:41:16FromDiscord<sOkam! 🫐> In reply to @elegantbeef "Well they always could": that would be part of the goal of implementing semantics, yeah
23:41:36FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "If you use Nim's": except I don't want nim rules, just nim syntax 🤷‍♂️
23:41:46FromDiscord<Robyn [She/Her]> Fair enough
23:41:57FromDiscord<sOkam! 🫐> I would need to make a backend, not a StoS compiler, for that to be usable
23:42:08FromDiscord<Robyn [She/Her]> Yeah good point
23:42:27FromDiscord<Robyn [She/Her]> You could probably support a limited subset of macros that get translated into C source code tbf
23:42:44FromDiscord<Robyn [She/Her]> But a C preprocessor is closer to a template, right?
23:42:52FromDiscord<sOkam! 🫐> in case of implementing something, though, it would 100% go on the Nim VM. there is no way im implementing anything serious on the C preprocessor. that thing is hell
23:43:00FromDiscord<Robyn [She/Her]> Lol
23:43:09FromDiscord<sOkam! 🫐> at least the VM has types
23:43:30FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "But a C preprocessor": it is very similar, yeah, minus the ability to type things
23:43:34FromDiscord<Robyn [She/Her]> C has types, they can just be ignored xD
23:43:40FromDiscord<sOkam! 🫐> so its like all untyped, and no introspection
23:43:49FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "C has types, they": not in macros
23:43:50FromDiscord<Robyn [She/Her]> Sounds glorious /s
23:43:55FromDiscord<ElegantBeef> In reply to @heysokam "it is very similar,": If you cannot type things how are the macros written?
23:44:02FromDiscord<ElegantBeef> 🥁
23:44:14FromDiscord<sOkam! 🫐> didn't get the wordplay, lol 😄
23:44:25FromDiscord<sOkam! 🫐> was gonna answer, saw the drums... and was like... oh, im dum 😄
23:45:02FromDiscord<Robyn [She/Her]> In reply to @elegantbeef "If you cannot type": Zap the ones and zeros onto the harddrive, ez
23:45:10FromDiscord<ElegantBeef> "Harddrive"?
23:46:18FromDiscord<sOkam! 🫐> could there be a way to differentiate which `TNodeKind` are used in semantics, and which are in the raw AST?
23:46:41FromDiscord<sOkam! 🫐> sometimes I see node kinds, and I just don't know if I'm missing part of the syntax or if I should just ignore them because they are never parsed
23:48:44FromDiscord<ElegantBeef> To say the unhelpful thing, if it cannot be parsed it will not be matched 😄
23:50:51FromDiscord<ElegantBeef> The trick is to just do `else: raise newError(UnimplementedError, "Unimplemented operation for: " & $node.kind")`
23:59:40FromDiscord<sOkam! 🫐> i mean, that's what I have. but I don't have an `all syntax ever possible` file to parse to find them