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:05 | FromDiscord | <albassort> beef do you know about AES |
01:27:12 | FromDiscord | <albassort> or any of you |
01:28:54 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=VuzoLTBB |
01:29:03 | FromDiscord | <albassort> seems this is not expected? |
01:48:35 | FromDiscord | <ElegantBeef> In reply to @albassort "beef do you know": I know that they're 3 letters from the English alphabet |
01:49:03 | FromDiscord | <albassort> see Beef I like to believe that you know everything about everything im working with |
01:49:09 | FromDiscord | <albassort> but its that you know everything about nim |
01:50:37 | FromDiscord | <ElegantBeef> You are asking though "Is it expected for encryption to accept any key" |
01:51:20 | FromDiscord | <albassort> no i just didn't read the RFC or wikipedia because im stupid |
01:51:34 | FromDiscord | <albassort> CBC returns the first block of the IV in the first block of the response |
01:51:55 | FromDiscord | <ElegantBeef> No CBC is a crown owned Canadian broadcaster |
01:52:19 | FromDiscord | <albassort> beef i declared a cstring with let but these procedures are still mutatting it |
01:52:21 | FromDiscord | <albassort> (edit) "mutatting" => "mutating" |
01:52:29 | FromDiscord | <ElegantBeef> You're joking right? |
01:52:34 | FromDiscord | <albassort> no |
01:52:36 | FromDiscord | <albassort> :) |
01:52:53 | FromDiscord | <ElegantBeef> Now I don't know if to insult your or answer the question |
01:52:59 | FromDiscord | <ElegantBeef> (edit) "your" => "you" |
01:53:30 | FromDiscord | <albassort> I understand why but it shouldn't be happening |
01:53:56 | FromDiscord | <ElegantBeef> You're passing a cstring to something that expects it to be a mutable buffer |
01:54:03 | FromDiscord | <albassort> then make it var! |
01:54:17 | FromDiscord | <ElegantBeef> You're the one passing the cstring to a procedure that is mutating data |
01:54:28 | FromDiscord | <albassort> hey i didn't write this procedure |
01:54:38 | FromDiscord | <ElegantBeef> `let` and `var` only exist in Nim and you can override them using unsafe operations |
01:55:24 | FromDiscord | <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:38 | FromDiscord | <ElegantBeef> Cause that is overhead for no reason |
01:56:23 | FromDiscord | <albassort> well then have it only run on -d:debug to dissuade people during development from doing this |
01:57:06 | FromDiscord | <ElegantBeef> I mean you should not have unsafe procedures exposed to the user |
01:57:10 | FromDiscord | <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:35 | FromDiscord | <ElegantBeef> Well the procedure should likely take `var openArray[T]` |
01:58:52 | FromDiscord | <albassort> i mean yeah, its supposed to be generated from random bytes |
01:59:17 | FromDiscord | <albassort> i have to convert it manually to a cstring and no CSPRNG procedure will by default return a string |
01:59:26 | FromDiscord | <ElegantBeef> Also it's not like it's changing where the pointer points |
01:59:34 | FromDiscord | <ElegantBeef> It's just mutating the data at the ptr |
02:00:30 | FromDiscord | <albassort> it would be good form to tell me rather than me debugging for 10 minutes |
02:00:50 | FromDiscord | <ElegantBeef> Well Nim `let` does not effect data pointers point to |
02:01:09 | FromDiscord | <ElegantBeef> So even `let x = new int; x[] = 300` is valid |
02:03:24 | FromDiscord | <albassort> uhm actually thats a reference not a pointer |
02:04:28 | * | xet7 quit (Ping timeout: 268 seconds) |
02:04:31 | FromDiscord | <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:09 | FromDiscord | <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:19 | FromDiscord | <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:01 | FromDiscord | <albassort> regardless of practicality: the author of nimAES failed to inform me of the mutability of cstring provided into their functions |
03:20:37 | FromDiscord | <ElegantBeef> Well there are no docs for it 😄 |
03:21:26 | FromDiscord | <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:36 | FromDiscord | <albassort> perhaps the author is just not very aware of mutability |
03:22:31 | FromDiscord | <riku5543> Can you post example code? |
03:22:58 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=CIIydqIB |
03:23:08 | FromDiscord | <albassort> input string should be pretty long |
03:23:17 | FromDiscord | <albassort> i ported it over to a different file to make proper functions for database things |
03:23:21 | FromDiscord | <ElegantBeef> ` copyMem(iv, output, 16)` they clearly know about mutabillity |
03:23:53 | FromDiscord | <albassort> sorry the code is kinda insane and isorganized but i was debugging and im not currently fixing that |
03:24:04 | FromDiscord | <albassort> (edit) "isorganized" => "inorganized" |
03:24:11 | FromDiscord | <albassort> (edit) "inorganized" => "unorganized" |
03:24:25 | FromDiscord | <riku5543> Idk anything about the aes library but shouldn't init only be called one time? |
03:24:41 | FromDiscord | <albassort> In reply to @albassort "there also an issue": . |
03:24:53 | FromDiscord | <albassort> if you don't do that the decrypt doesn't work |
03:24:58 | FromDiscord | <albassort> returns noise |
03:39:13 | FromDiscord | <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:29 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=rpXUiAuP |
03:46:58 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1250657641752166410/message.txt?ex=666bbd31&is=666a6bb1&hm=d837b3aad9c01e37a9e6d34c37e9097b3455f479480a369e8d272831270cb867& |
03:47:05 | FromDiscord | <albassort> heres a real world example |
03:47:29 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=WsTQVwDT |
03:47:45 | FromDiscord | <albassort> (no that private key is mine) |
03:47:49 | FromDiscord | <albassort> (edit) "(no that private key is ... mine)" added "not" |
03:48:43 | FromDiscord | <riku5543> What's the expected output? |
03:48:55 | FromDiscord | <albassort> the output is the same as the input |
03:49:04 | FromDiscord | <albassort> with the code i posted earlier it works fine |
03:49:16 | FromDiscord | <albassort> but it sets the decode and encode every loop and inits it |
03:49:43 | FromDiscord | <albassort> this one sets it 1 time, and it outputs noise |
04:02:04 | FromDiscord | <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:27 | FromDiscord | <albassort> Oh i didn't need help, I was explaining that this issue exists |
04:04:12 | FromDiscord | <morgan> so im getting back to the nim bgfx idl code gen thing, and thinking more about enums for bitfields |
04:05:09 | FromDiscord | <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:16 | FromDiscord | <morgan> (edit) "ord(a)" => "`ord(a)" | "ord(b)" => "ord(b)`" |
04:05:25 | * | coldfeet joined #nim |
04:08:48 | FromDiscord | <morgan> or i guess i'll just stick with my previous solution |
04:09:54 | FromDiscord | <morgan> tho it means i have to do a bit more work to get the predefined combined options available |
04:10:00 | FromDiscord | <morgan> or not make them available |
04:10:17 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#pasty=aViiBvBt |
04:14:02 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=TnZPQmHw |
04:15:08 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#pasty=MuiXGiRb |
04:15:24 | FromDiscord | <riku5543> Ah nice :3 |
04:15:28 | FromDiscord | <riku5543> (edit) removed ":3" |
04:15:34 | FromDiscord | <morgan> except i will need to change that to manually set values |
04:16:04 | FromDiscord | <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:14 | FromDiscord | <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:18 | FromDiscord | <morgan> in lua 💀 |
04:17:41 | FromDiscord | <morgan> (i have to do this in lua, it has been much more pain than it would've been in nim) |
04:18:14 | FromDiscord | <ElegantBeef> You can just `cast[uint32](yourSet)` |
04:19:18 | FromDiscord | <morgan> that's the same as ord, right? |
04:19:45 | FromDiscord | <ElegantBeef> No cause it's a set[enum] -> uint32 |
04:21:21 | FromDiscord | <morgan> oh that converts the set to an int |
04:21:28 | FromDiscord | <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:27 | FromDiscord | <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:58 | FromDiscord | <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:19 | FromDiscord | <sOkam! 🫐> (edit) "btw. if" => "btw↵if" |
12:25:11 | * | ntat joined #nim |
12:32:18 | PMunch | Oh fuck me.. |
12:32:34 | PMunch | I've been struggling with some embedded Nim code, translated from C code |
12:32:39 | PMunch | For weeks! |
12:34:28 | PMunch | I 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:33 | FromDiscord | <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:20 | FromDiscord | <pmunch> It was updating the value in memory |
12:58:35 | FromDiscord | <pmunch> Not the pointer itself |
12:59:12 | FromDiscord | <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:43 | FromDiscord | <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:49 | FromDiscord | <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:24 | FromDiscord | <albassort> do i need to dalloc cstrings |
13:40:36 | FromDiscord | <albassort> if a cstring is created in a ffi function do i need to worry about it |
13:41:47 | FromDiscord | <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:51 | FromDiscord | <Phil> (edit) "lib" => "C-lib" |
13:42:17 | FromDiscord | <albassort> will ARC remove it or if it leaves the scope will it be a stale value |
13:42:22 | FromDiscord | <albassort> will they memory leak |
13:42:34 | FromDiscord | <ieltan> yeah it will leak if it was malloc'ed |
13:42:38 | FromDiscord | <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:46 | FromDiscord | <Phil> Assuming you get ownership |
13:42:55 | FromDiscord | <ieltan> basically |
13:42:56 | FromDiscord | <Phil> That should be documented by the lib if it expects you to "deallocate" or not |
13:43:04 | FromDiscord | <albassort> im the one writing the lib |
13:43:06 | FromDiscord | <albassort> 😠 |
13:43:08 | FromDiscord | <Phil> If you deallocate, the library must provide a deallocation function, you never manually allocate yourself |
13:43:16 | FromDiscord | <Phil> (edit) "allocate" => "deallocate" |
13:43:23 | FromDiscord | <Phil> Because you can't make assumption about which allocator the lib used |
13:43:56 | FromDiscord | <Phil> In that case hand them pointers and don't expect ARC to do jack |
13:44:00 | FromDiscord | <albassort> well, it used the rust-c-ffi allocator for creating c-pointers that survive outside the scope of rust |
13:44:13 | FromDiscord | <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:24 | FromDiscord | <albassort> the problem is idk how rust works |
13:44:46 | FromDiscord | <albassort> if it was C I know it used malloc, its on the heap of the thread it was created on |
13:44:49 | FromDiscord | <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:14 | FromDiscord | <exelotl> In reply to @PMunch "I was doing iteration": wow... I didn't know you could use `var` like that 😅 |
13:45:14 | FromDiscord | <Phil> Because you can't know when they are done with the value you gave them |
13:45:34 | FromDiscord | <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:08 | FromDiscord | <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:16 | FromDiscord | <albassort> alright next question |
13:46:22 | FromDiscord | <albassort> if i create a cstring do i need to dalloc that too? |
13:47:10 | FromDiscord | <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:55 | FromDiscord | <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:00 | FromDiscord | <ieltan> @albassort |
13:48:19 | FromDiscord | <albassort> i meant create a cstring like this |
13:48:33 | FromDiscord | <ieltan> (edit) "it" => "a specific part of it, " |
13:48:43 | FromDiscord | <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:50 | FromDiscord | <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:53 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=yaKetNVc |
13:49:09 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=NNLWDXyA" => "https://play.nim-lang.org/#pasty=bSmfPVvX" |
13:49:37 | FromDiscord | <pmunch> You don't have to free that one |
13:49:41 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=ZmerGiuk |
13:49:49 | FromDiscord | <pmunch> It will get freed automatically when `foo` goes out of scope |
13:50:07 | FromDiscord | <ieltan> In reply to @isofruit "For compatibility I think": yup, keepin' it stupid simple |
13:50:37 | FromDiscord | <Phil> In reply to @ieltan "yup, keepin' it stupid": I like stupid code |
13:50:40 | FromDiscord | <Phil> Stupid code is on my level |
13:50:41 | FromDiscord | <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:56 | FromDiscord | <albassort> 👍 |
13:51:34 | FromDiscord | <albassort> the world if C used Pascal Strings:↵futurewithflyingcars.jpg |
13:53:37 | PMunch | Pascal strings? |
13:54:25 | FromDiscord | <albassort> In reply to @PMunch "Pascal strings?": what nim has |
13:54:57 | FromDiscord | <albassort> in memory it looks like ↵length : uint(x)↵data |
13:55:23 | PMunch | So not like a Nim string.. |
13:55:31 | FromDiscord | <albassort> well, same concept |
13:55:36 | PMunch | Sure |
13:55:36 | FromDiscord | <albassort> length then data |
14:04:10 | FromDiscord | <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:29 | FromDiscord | <Phil> ? |
14:04:48 | FromDiscord | <Phil> Is creating cstrings that painful? |
14:08:22 | FromDiscord | <ieltan> more like unfortunate |
14:08:33 | FromDiscord | <ieltan> `let arr = ['h', 'e', 'l', 'l', 'o', '\n'].addr.cstring` doesn't work |
14:09:34 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#pasty=ItwlQbQR |
14:09:47 | FromDiscord | <ieltan> hmm |
14:09:54 | FromDiscord | <ieltan> maybe i'm just stupid myself |
14:11:13 | FromDiscord | <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:00 | FromDiscord | <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:27 | FromDiscord | <Robyn [She/Her]> That's reasonable to me |
14:12:47 | FromDiscord | <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:21 | FromDiscord | <ieltan> yeah im stupud |
14:13:27 | FromDiscord | <ieltan> `let str = "something".cstring` |
14:13:31 | FromDiscord | <ieltan> lol |
14:13:40 | FromDiscord | <ieltan> sometime i think too much in c |
14:14:07 | FromDiscord | <ieltan> i need to get my head out of this pointer everything mindset |
14:15:28 | FromDiscord | <Robyn [She/Her]> "Not everything has a pointer, but a pointer can have anything" |
14:16:57 | FromDiscord | <ieltan> wait |
14:18:50 | FromDiscord | <ieltan> ughughughu |
14:19:18 | FromDiscord | <ieltan> now im not sure because i dont know how literals works in nim |
14:20:18 | FromDiscord | <ieltan> what actually happens when i do `let x = cstring("somelit")` |
14:20:21 | FromDiscord | <ieltan> ? |
14:22:37 | FromDiscord | <Robyn [She/Her]> In reply to @ieltan "what actually happens when": Why not check in the generated C source? |
14:22:54 | FromDiscord | <Robyn [She/Her]> Just add `--nimcache:cache` to the compile flag |
14:24:26 | FromDiscord | <ieltan> In reply to @chronos.vitaqua "Just add `--nimcache:cache` to": i'll do that later, thanks for the tip |
14:24:42 | FromDiscord | <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:03 | FromDiscord | <srabb> which is the best vscode extension for nim |
15:38:18 | FromDiscord | <srabb> out of the first three that i see |
15:43:08 | FromDiscord | <fabric.input_output> nim.nvim |
15:44:24 | * | beholders_eye joined #nim |
15:44:28 | FromDiscord | <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:13 | FromDiscord | <sOkam! 🫐> In reply to @morganalyssa "oh neat. my guess": enum sets are just bits or'ed together |
15:48:05 | FromDiscord | <morgan> yeah but like can i do that with values from several different enums |
15:48:43 | FromDiscord | <sOkam! 🫐> you would be going out of the typesystem in that case, so yeah definitely not compatible between enums |
15:48:58 | FromDiscord | <sOkam! 🫐> enums values in C (well almost evreything really) is hella unsafe |
15:49:02 | FromDiscord | <sOkam! 🫐> (edit) "evreything" => "everything" |
15:49:04 | FromDiscord | <morgan> that’s what i thought |
15:49:44 | FromDiscord | <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:55 | FromDiscord | <morgan> it’s like 60 options spread over like 10ish types for some reason, in the high level interface description |
15:50:12 | FromDiscord | <morgan> rather than defining each bit in one thing |
15:50:27 | FromDiscord | <sOkam! 🫐> ic. classic C chaos, it seems |
15:51:10 | FromDiscord | <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:51 | FromDiscord | <morgan> it probably does include other groups like that |
15:53:43 | FromDiscord | <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:07 | FromDiscord | <sOkam! 🫐> classic C chaotic ordering, indeed |
15:58:53 | * | krux02 quit (Ping timeout: 240 seconds) |
16:16:09 | FromDiscord | <sOkam! 🫐> how can I create a valid `nkDo` or `nnkDo` through code, without using the NimNode functions to create it? |
16:16:25 | FromDiscord | <sOkam! 🫐> something that if I parse it, I would get a `nkDo` |
16:16:59 | FromDiscord | <fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=arVRBxxB |
16:17:11 | FromDiscord | <fabric.input_output> the `do:` is going to get parsed as a `nnkDo` iirc |
16:17:32 | FromDiscord | <fabric.input_output> (edit) "a" => "an" |
16:18:43 | FromDiscord | <fabric.input_output> @sOkam! 🫐 is this what you wanted? |
16:19:54 | FromDiscord | <sOkam! 🫐> idk, let me try it ✍️ |
16:22:45 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=oYXeTahU |
16:23:13 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=qbPWsaGg |
16:23:21 | FromDiscord | <Robyn [She/Her]> Iirc do is just transformed to a stmt list |
16:23:33 | FromDiscord | <Robyn [She/Her]> Like, always |
16:23:45 | FromDiscord | <Robyn [She/Her]> Have you checked in the compiler code? |
16:23:53 | FromDiscord | <fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=ntoqBaOS |
16:24:01 | FromDiscord | <fabric.input_output> nvm I'll try it |
16:24:10 | FromDiscord | <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:44 | FromDiscord | <Robyn [She/Her]> In reply to @heysokam "figured I should ask": Fair |
16:24:54 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=MDrVCHqV |
16:25:13 | FromDiscord | <Robyn [She/Her]> Oh nice |
16:26:12 | FromDiscord | <fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=TlPNIUrP |
16:27:55 | FromDiscord | <sOkam! 🫐> doesn't sound like I can use it for creating `do { BODY } while (CONDITION);` though 😦 |
16:28:41 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=zzGYMtnZ |
16:30:00 | FromDiscord | <fabric.input_output> In reply to @heysokam "what is it about": the function signature thingy between `do` and `:` |
16:30:08 | FromDiscord | <fabric.input_output> it's syntax sugar for higher order functions |
16:31:34 | FromDiscord | <threefour> Does anyone know of an IPP library for Nim? |
16:31:49 | FromDiscord | <fabric.input_output> sent a code paste, see https://play.nim-lang.org/#pasty=UmeIWSNW |
16:32:04 | FromDiscord | <fabric.input_output> (edit) "https://play.nim-lang.org/#pasty=VNFypvsp" => "https://play.nim-lang.org/#pasty=oQjphPZb" |
16:32:26 | FromDiscord | <sOkam! 🫐> oh i see |
16:36:11 | FromDiscord | <fabric.input_output> chat is this real https://media.discordapp.net/attachments/371759389889003532/1250851219887624273/image.png?ex=666c717a&is=666b1ffa&hm=022ffe3c2dcdc6fbc6fc69abae71579df35ef8d3b1e87578377c25ba753068f6& |
16:36:16 | FromDiscord | <fabric.input_output> (about nim) |
16:36:34 | FromDiscord | <fabric.input_output> I'm trying to understand how the dispatch tree mechanism works |
16:51:31 | FromDiscord | <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:32 | FromDiscord | <fabric.input_output> idk, wikipedia could be wrong |
17:03:12 | FromDiscord | <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:30 | FromDiscord | <Robyn [She/Her]> Does anyone know how I'd define sane ratelimits for my API or nah? |
17:04:43 | FromDiscord | <fabric.input_output> In reply to @chronos.vitaqua "Does anyone know how": threading, async or plain old single thread? |
17:05:42 | FromDiscord | <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:15 | FromDiscord | <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:09 | FromDiscord | <fabric.input_output> a mutex, a uint64 and a function is all you need tbh |
17:07:26 | FromDiscord | <fabric.input_output> mutex or lock idk the exact terminology |
17:07:30 | FromDiscord | <Robyn [She/Her]> Still not my question aha, I'm asking how do I decide the time, specifically |
17:07:36 | FromDiscord | <fabric.input_output> ah |
17:07:50 | FromDiscord | <fabric.input_output> see if the website says something about rate limits? |
17:07:59 | FromDiscord | <Robyn [She/Her]> It's for my own server |
17:08:46 | FromDiscord | <fabric.input_output> hmm |
17:09:45 | FromDiscord | <fabric.input_output> maybe check and benchmark how many requests at a time your server can handle and go from there? |
17:10:34 | FromDiscord | <Robyn [She/Her]> Still doesn't seem wise to allow 100 requests to create an account at once tbh |
17:11:43 | FromDiscord | <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:44 | FromDiscord | <fabric.input_output> just pick an arbitrary number that seems reasonable I'd say |
17:15:01 | FromDiscord | <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:00 | FromDiscord | <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:46 | FromDiscord | <Robyn [She/Her]> How hard is it to get a basic email server that can only send messages, working? |
18:49:06 | FromDiscord | <Robyn [She/Her]> And how would I test it without a domain name? Send it to a local email server? |
18:54:26 | Amun-Ra | xkonti: it's as stable as nimsuggest |
19:07:41 | FromDiscord | <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:57 | Amun-Ra | often it works like a charm, other times nimsuggest leaves a core file |
19:11:15 | Amun-Ra | "nimsuggest instance for project /home/amun/nim/ronin/src stopped with exitcode: 139" |
19:12:27 | Amun-Ra | I had to move core generation to /tmp not to kill my nvme ;) |
19:17:01 | * | ntat quit (Quit: Leaving) |
19:20:40 | FromDiscord | <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:43 | Amun-Ra | same, nim.nvim |
19:24:42 | FromDiscord | <.alea.> sent a code paste, see https://play.nim-lang.org/#pasty=ZeNqJJyV |
19:25:17 | FromDiscord | <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:55 | Amun-Ra | what's conditional member name? |
19:26:19 | Amun-Ra | ah |
19:26:25 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=LjMszIps |
19:26:51 | FromDiscord | <.alea.> so it is ok to just treat the names of struct member as variables |
19:26:54 | FromDiscord | <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:59 | FromDiscord | <.alea.> (edit) "member" => "members" |
19:27:34 | FromDiscord | <xkonti> In reply to @juancarlospaco "Theoretically Jetbrains has an": It's just syntax highlighting as far as I tested it... |
19:29:09 | FromDiscord | <juancarlospaco> In reply to @.alea. "so it is ok": Iff it is mutable you can assign to it. |
19:29:32 | FromDiscord | <bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=NrZYywgQ |
19:29:34 | FromDiscord | <juancarlospaco> (edit) "assign" => "assign/re-assign" |
19:29:47 | FromDiscord | <.alea.> sent a code paste, see https://play.nim-lang.org/#pasty=dQFgSiSq |
19:30:14 | FromDiscord | <.alea.> is there any way to make nim treat 'x' like a name |
19:30:28 | FromDiscord | <.alea.> like a macro or something? |
19:30:51 | FromDiscord | <juancarlospaco> But condMember is not a field of Test. |
19:31:12 | FromDiscord | <.alea.> basically I guess I want a macro to replace condMember with x |
19:31:47 | FromDiscord | <bosinski2023> In reply to @.alea. "basically I guess I": yep, you need a macro for that.. |
19:32:38 | FromDiscord | <xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=DEBJDGQA |
19:35:39 | FromDiscord | <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:02 | FromDiscord | <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:19 | FromDiscord | <nervecenter> (edit) "modules" => "module's" |
19:40:38 | FromDiscord | <nervecenter> (edit) "them" => "normal procedures into templates" |
19:41:02 | FromDiscord | <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:23 | FromDiscord | <.alea.> In reply to @bosinski2023 "@Alea at the end": That looks pretty good! I'll have to investigate down that route |
19:50:30 | FromDiscord | <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:06 | FromDiscord | <juancarlospaco> proc does take | |
19:52:17 | FromDiscord | <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:24 | FromDiscord | <nervecenter> This is confusing |
19:53:23 | * | coldfeet quit (Remote host closed the connection) |
19:53:51 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=CWDtBNHW |
19:54:02 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=FyslyhkC |
19:54:24 | FromDiscord | <Robyn [She/Her]> Even weirder, in my actual code, not the small example I made here, I got a generic instantiation error |
19:58:12 | FromDiscord | <juancarlospaco> In reply to @nervecenter "I've noticed that if": Only symbols with are visible from the outside. |
19:59:17 | FromDiscord | <nervecenter> These are procs in the SAME module as those symbols |
19:59:34 | FromDiscord | <nervecenter> Well, not the imported module symbols |
20:00:05 | FromDiscord | <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:08 | FromDiscord | <nervecenter> They just broke completely |
20:00:09 | FromDiscord | <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:19 | FromDiscord | <Robyn [She/Her]> (edit) "cast" => "upcast" |
20:03:29 | FromDiscord | <ElegantBeef> In reply to @nervecenter "Can anyone tell me": "template procedures"? |
20:03:30 | FromDiscord | <nervecenter> Even the `[]` proc from `std/tables` is invisible from inside those procs now |
20:03:55 | FromDiscord | <nervecenter> In reply to @elegantbeef ""template procedures"?": What do you call procedures that use `|` to take multiple types for some parameters? |
20:04:18 | FromDiscord | <ElegantBeef> Generics |
20:04:36 | FromDiscord | <nervecenter> Se even if the types are constrained it's still called generic? |
20:04:38 | FromDiscord | <nervecenter> Alright then |
20:04:42 | FromDiscord | <nervecenter> (edit) "Se" => "So" |
20:04:47 | FromDiscord | <ElegantBeef> Yes |
20:04:53 | FromDiscord | <ElegantBeef> It's a typeclassed generic |
20:05:03 | FromDiscord | <ElegantBeef> You're likely hitting a binding issue |
20:05:15 | FromDiscord | <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:23 | FromDiscord | <ElegantBeef> If you can share the procedure definition and usage that'd help |
20:05:37 | FromDiscord | <nervecenter> I need to edit it down |
20:07:00 | FromDiscord | <nervecenter> Actually that's going to be virtually impossible, these are not small procedures |
20:07:11 | FromDiscord | <nervecenter> And I can't share proprietary stuff here |
20:07:23 | FromDiscord | <ElegantBeef> Well put `bind symbolName` inside the generic |
20:08:22 | FromDiscord | <nervecenter> I see |
20:10:09 | FromDiscord | <ElegantBeef> In theory you never need `bind`, but sometimes generic symbols are funky |
20:27:47 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=yvpcrcHp |
20:27:50 | FromDiscord | <Robyn [She/Her]> Odd... |
20:28:21 | FromDiscord | <Robyn [She/Her]> `proc isUnsealedImpl(provider: Repository): bool = SQLiteRepository(provider).db.isOpen`↵That's the snippet on the line |
20:33:30 | FromDiscord | <Robyn [She/Her]> Do I need to forcefully cast it? :/ |
20:34:56 | * | xet7 joined #nim |
20:35:18 | FromDiscord | <fabric.input_output> In reply to @chronos.vitaqua "Do I need to": Repository has no inheritance connection with SQLiteRepository it seems? |
20:35:48 | FromDiscord | <thomasnh> sent a long message, see https://pasty.ee/QwFanwfJ |
20:36:00 | FromDiscord | <fabric.input_output> In reply to @chronos.vitaqua "Do I need to": try to softly cast (aka convert) |
20:36:09 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=wLgGOxPP |
20:36:37 | FromDiscord | <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:57 | FromDiscord | <fabric.input_output> not with `cast` |
20:36:58 | FromDiscord | <Robyn [She/Her]> In reply to @chronos.vitaqua "`proc isUnsealedImpl(provider: Repository): bool": That's what I did here |
20:37:07 | FromDiscord | <Robyn [She/Her]> That's a normal conversion |
20:38:44 | FromDiscord | <fabric.input_output> odd |
20:39:39 | FromDiscord | <Robyn [She/Her]> Yeah, my thoughts exactly |
20:40:16 | FromDiscord | <fabric.input_output> how many overloads of `isUnsealedImpl` are there? |
20:40:45 | FromDiscord | <ElegantBeef> `proc(_: Child)` is not convertible to `proc(_: Parent)` |
20:40:50 | FromDiscord | <fabric.input_output> maybe you are getting the wrong one? have you tried not to cast it before calling it? |
20:40:50 | FromDiscord | <Robyn [She/Her]> In reply to @fabric.input_output "how many overloads of": Just the one |
20:40:57 | FromDiscord | <Robyn [She/Her]> In reply to @elegantbeef "`proc(_: Child)` is not": Wdym? |
20:41:01 | FromDiscord | <ElegantBeef> For your first issue |
20:41:12 | FromDiscord | <ElegantBeef> `(proc(r: SQLiteRepository): bool)isUnsealedImpl` this is not valid |
20:41:17 | FromDiscord | <fabric.input_output> In reply to @chronos.vitaqua "Just the one": you did `isUnsealedImpl(repo.Repository)` right? |
20:41:23 | FromDiscord | <Robyn [She/Her]> In reply to @elegantbeef "`(proc(r: SQLiteRepository): bool)isUnsealedImpl` t": Ah yeah I fixed that |
20:41:56 | FromDiscord | <Robyn [She/Her]> In reply to @fabric.input_output "you did `isUnsealedImpl(repo.Repository)` right?": That's in another file |
20:42:07 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#pasty=xYGnfStm |
20:42:19 | FromDiscord | <Robyn [She/Her]> In reply to @elegantbeef "What's this line?": It's the code I sent below |
20:42:58 | FromDiscord | <Robyn [She/Her]> `SQLiteRepository` inherits from `Repository` so that shouldn't be an issue |
20:43:15 | FromDiscord | <fabric.input_output> no you have to cast to the appropriate type |
20:43:40 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#pasty=OKYtyHwN |
20:43:42 | FromDiscord | <ElegantBeef> Works fine |
20:43:55 | FromDiscord | <Robyn [She/Her]> In reply to @fabric.input_output "no you have to": What do you mean? |
20:44:03 | FromDiscord | <ElegantBeef> In reply to @thomasnh "Hey Been": It's not a hurdle, it literally does not matter |
20:44:17 | FromDiscord | <ElegantBeef> If you write well written C# you already do indention significant code |
20:44:46 | FromDiscord | <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:16 | FromDiscord | <ElegantBeef> Well provide a reproduction of the issue |
20:46:20 | FromDiscord | <Robyn [She/Her]> sent a long message, see https://pasty.ee/FsnSAJCu |
20:46:34 | FromDiscord | <Robyn [She/Her]> When trimmed down, it works perfectly |
20:46:43 | FromDiscord | <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:24 | FromDiscord | <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:26 | FromDiscord | <ElegantBeef> `obj: ref object` |
20:47:28 | FromDiscord | <fabric.input_output> or is it that you can cast to a parent but not to a child? |
20:47:32 | FromDiscord | <ElegantBeef> You're using implicit generics |
20:47:45 | FromDiscord | <ElegantBeef> `obj: typedesc[ref object]` you're using generics even further |
20:48:13 | FromDiscord | <ElegantBeef> You are attempting to make `Repository` generic, but give it no generic parameters |
20:49:35 | FromDiscord | <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:46 | FromDiscord | <ElegantBeef> Well you have an unrepresentable type |
20:49:49 | FromDiscord | <Robyn [She/Her]> And iirc you can't store a `proc[T](t: T)` |
20:49:50 | FromDiscord | <ElegantBeef> `seq[ref object]` is nto valid |
20:49:54 | FromDiscord | <ElegantBeef> not |
20:50:06 | FromDiscord | <Robyn [She/Her]> That's great, then :/ |
20:50:16 | FromDiscord | <Robyn [She/Her]> Would methods work here, then? |
20:50:24 | FromDiscord | <ElegantBeef> No cause the same issue appears |
20:50:33 | FromDiscord | <ElegantBeef> You need a method for each type you want to `deposit` |
20:50:42 | * | xet7 quit (Remote host closed the connection) |
20:50:46 | FromDiscord | <Robyn [She/Her]> Because I can't have generic methods? |
20:50:48 | FromDiscord | <ElegantBeef> Procs work just fine here if you make a serialization protocol |
20:50:59 | FromDiscord | <Robyn [She/Her]> In reply to @elegantbeef "Procs work just fine": Oh? How would that work? |
20:51:12 | FromDiscord | <ElegantBeef> You make a proc for each atom then make a generic wrapper for higherlevel wrappings |
20:51:24 | FromDiscord | <Robyn [She/Her]> I don't get it |
20:51:33 | FromDiscord | <ElegantBeef> `depositInt, depostFloat, depositString, depositBleh` .... |
20:51:53 | FromDiscord | <ElegantBeef> Then you have a `proc deposit(repo: Repository, value: auto)` |
20:51:59 | FromDiscord | <ElegantBeef> And deposit all the parts of `value` |
20:52:28 | FromDiscord | <Robyn [She/Her]> By doing `for field in typ.fields`? |
20:53:05 | FromDiscord | <ElegantBeef> Sure |
20:53:46 | FromDiscord | <Robyn [She/Her]> Honestly I might just go back to my original way of doing this |
20:54:30 | FromDiscord | <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:02 | FromDiscord | <ElegantBeef> Just wrap your types in an object variant and call it a day |
20:56:02 | FromDiscord | <Robyn [She/Her]> That'd work probably |
21:19:28 | FromDiscord | <Robyn [She/Her]> It does indeed work :> |
21:33:37 | FromDiscord | <Robyn [She/Her]> Is `cast[uint64](mySet)` portable or do I need to account for endianness? |
21:35:11 | FromDiscord | <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:26 | FromDiscord | <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:34 | FromDiscord | <Robyn [She/Her]> @ElegantBeef because you're using Discord here more |
21:48:07 | FromDiscord | <ElegantBeef> More like the bridge is down 😛 |
21:48:40 | FromDiscord | <ElegantBeef> In reply to @chronos.vitaqua "Oh, and also if": As long as the size of the set does not change |
22:00:53 | FromDiscord | <Robyn [She/Her]> What's a sane maximum required password length for accounts? |
22:02:04 | FromDiscord | <Robyn [She/Her]> Typical max is 128, seems fine to me |
22:02:41 | FromDiscord | <ElegantBeef> 64 or 128 is fine for unsalted unhashed password |
22:03:42 | FromDiscord | <ElegantBeef> I know a lot of sites limit to 32 characters |
22:04:20 | FromDiscord | <zumi.dxy> "password too strong" |
22:11:56 | FromDiscord | <Robyn [She/Her]> Lol |
22:14:24 | FromDiscord | <that_dude.> The length really doesn't matter if you hash it right? |
22:14:42 | FromDiscord | <that_dude.> Ig you could make a ddos argument |
22:14:42 | FromDiscord | <fabric.input_output> salt and pepper your password |
22:15:08 | FromDiscord | <that_dude.> But hashing should be done client side anyways |
22:15:12 | FromDiscord | <fabric.input_output> password peppering is a real thing btw |
22:16:56 | FromDiscord | <Robyn [She/Her]> In reply to @that_dude. "The length really doesn't": True ig |
22:17:11 | FromDiscord | <Robyn [She/Her]> In reply to @fabric.input_output "salt and pepper your": I'm just using argon2 to hash it :p |
22:17:35 | FromDiscord | <Robyn [She/Her]> In reply to @that_dude. "But hashing should be": How would the server guarantee the client hashed it though? |
22:24:13 | FromDiscord | <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:11 | FromDiscord | <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:25 | FromDiscord | <Robyn [She/Her]> Fair |
22:25:38 | FromDiscord | <Robyn [She/Her]> I might offload the hashing to clients then |
22:26:20 | FromDiscord | <that_dude.> Iirc pepper is basically a server side secret salt that you can use to further add a layer of complexity. |
22:27:05 | FromDiscord | <that_dude.> Unless your site is https only, it's def possible to read the password from intercepting the web requests |
22:28:10 | FromDiscord | <ElegantBeef> If your site is only http you have more problems |
22:28:12 | FromDiscord | <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:43 | FromDiscord | <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:20 | FromDiscord | <Robyn [She/Her]> How would I compare two argon2 hashes with eachother, then? |
22:31:22 | FromDiscord | <demotomohiro> In reply to @that_dude. "The client sends you": What if hacker steal the hash and used it to login? |
22:32:05 | FromDiscord | <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:39 | FromDiscord | <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:20 | FromDiscord | <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:51 | FromDiscord | <that_dude.> Or have some form of tfa |
22:33:54 | FromDiscord | <that_dude.> 2fa |
22:34:21 | FromDiscord | <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:27 | strogon14 | it's not |
22:36:39 | FromDiscord | <that_dude.> ^ |
22:37:10 | FromDiscord | <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:27 | FromDiscord | <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:35 | FromDiscord | <ElegantBeef> You lose the stdlib |
22:37:38 | FromDiscord | <ElegantBeef> You lose exceptions |
22:37:41 | FromDiscord | <that_dude.> It just protects from more attack vectors. It also protects others from database leaks |
22:37:41 | FromDiscord | <ElegantBeef> You cannot use `string` |
22:37:45 | FromDiscord | <ElegantBeef> You cannot use `ref` |
22:37:47 | FromDiscord | <ElegantBeef> And so forth |
22:38:12 | FromDiscord | <kcvinker5420> So basically, I need to go back to the old C style, right ? |
22:38:53 | FromDiscord | <ElegantBeef> Yes, just use arc |
22:39:16 | FromDiscord | <ElegantBeef> You can do manual memory management but use arc and not lose the entire stdlib |
22:39:28 | FromDiscord | <ElegantBeef> Plus you do not have to manually manage resources |
22:39:30 | FromDiscord | <kcvinker5420> In reply to @elegantbeef "You can do manual": Is it ? |
22:39:44 | FromDiscord | <Robyn [She/Her]> In reply to @strogon14 "it's not": Ah okay then |
22:39:45 | FromDiscord | <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:45 | FromDiscord | <ElegantBeef> Yes you can make your own data types using hooks |
22:40:16 | FromDiscord | <demotomohiro> If you dont use heap memory, you don't need manual memory management. |
22:40:37 | FromDiscord | <ElegantBeef> Even if you do use heap memory you do not need manual management 😛 |
22:40:42 | FromDiscord | <kcvinker5420> In reply to @demotomohiro "If you dont use": I need to heap memory, since I am planning to make a dll |
22:41:06 | FromDiscord | <ElegantBeef> So why are you attempting to avoid the gc |
22:41:57 | FromDiscord | <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:15 | FromDiscord | <kcvinker5420> Like, we determined destruction |
22:42:16 | FromDiscord | <ElegantBeef> Well sure, but you do not need to use manual memory management that way |
22:42:28 | FromDiscord | <kcvinker5420> Oh I see |
22:42:38 | FromDiscord | <kcvinker5420> Can you explain a little more please ? |
22:42:42 | FromDiscord | <ElegantBeef> You can use `--mm:arc` and give resources to the C ffi delaying ref counts |
22:43:10 | FromDiscord | <zumi.dxy> would there be any problems in using `orc` for shared libs? |
22:43:16 | FromDiscord | <ElegantBeef> No |
22:44:07 | FromDiscord | <ElegantBeef> You can do `GcRef(myRef)` to increment a ref count |
22:44:25 | FromDiscord | <ElegantBeef> Then you later can `GcUnref` |
22:44:31 | FromDiscord | <kcvinker5420> Oh, thats nice |
22:44:50 | FromDiscord | <ElegantBeef> Then you just pass your `ref` as a `T` in C-ABI |
22:44:54 | FromDiscord | <kcvinker5420> Just like manual memory management, but we are managing ref counts, right |
22:45:21 | FromDiscord | <ElegantBeef> Well yea you want to extend the ref count outside of the Nim dll |
22:45:32 | FromDiscord | <kcvinker5420> Yes, got it |
22:45:58 | FromDiscord | <kcvinker5420> What does `a` stands for in arc ? |
22:46:03 | FromDiscord | <ElegantBeef> automatic |
22:46:12 | FromDiscord | <kcvinker5420> Oh i see |
22:46:26 | FromDiscord | <kcvinker5420> But here we are doing manually |
22:47:48 | FromDiscord | <ElegantBeef> sent a code paste, see https://play.nim-lang.org/#pasty=hmZjkJjJ |
22:48:36 | FromDiscord | <ElegantBeef> It's that simple now you can do `intptr_t myInt = makeInt(); printf("%d\n", (myInt)); deleteInt(myInt);` |
22:49:26 | FromDiscord | <ElegantBeef> Though you want to use Nim with https://github.com/nim-lang/Nim/commit/716ff93161b4d4a02bd4a29860ddb9375e2fda5d if exposing across to cdecls |
22:49:49 | FromDiscord | <kcvinker5420> In reply to @elegantbeef "It's that simple now": This is pretty straight forward. Nice |
22:49:53 | FromDiscord | <ElegantBeef> Otherwise NRVO will kick in silently and you will have `makeInt(intptr_t result)` |
22:50:16 | FromDiscord | <Robyn [She/Her]> Yay, `orc` breaks everything in my code now :'D |
22:50:18 | FromDiscord | <ElegantBeef> Remember to compile with valgrind and ensure no leaks |
22:50:29 | FromDiscord | <kcvinker5420> What's NRVO ? Nim Runtime .... |
22:50:31 | FromDiscord | <Robyn [She/Her]> Specifically the teardown for my code |
22:50:59 | FromDiscord | <ElegantBeef> Return value optimization |
22:51:16 | FromDiscord | <kcvinker5420> In reply to @elegantbeef "Remember to compile with": I am planning to wrap the allocation code with some bookkeeping code |
22:51:17 | FromDiscord | <ElegantBeef> Don't recall what the N stands for |
22:51:44 | FromDiscord | <Robyn [She/Her]> `Nim`, smh |
22:51:45 | FromDiscord | <ElegantBeef> Ah "named" |
22:52:20 | FromDiscord | <kcvinker5420> Instead of using valgrind, what if we use a map to record the allocations ? |
22:52:38 | FromDiscord | <ElegantBeef> Why would you do that when you have valgrind? |
22:52:44 | FromDiscord | <ElegantBeef> <https://github.com/beef331/seeya> also might be of interest to you |
22:53:05 | FromDiscord | <ElegantBeef> <https://github.com/beef331/seeya/blob/master/tests/mylib.nim> generates <https://github.com/beef331/seeya/blob/master/tests/mylib.h> |
22:55:57 | FromDiscord | <kcvinker5420> It copies the comments!! That's s great tool |
22:56:18 | FromDiscord | <ElegantBeef> Would be greater if it was done by the compiler |
22:56:52 | FromDiscord | <kcvinker5420> Ha ha, yeah |
23:03:52 | FromDiscord | <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:21 | FromDiscord | <ElegantBeef> Yea, it'd be nice to get headers automatically generated from all exposed code and types |
23:08:11 | FromDiscord | <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:52 | FromDiscord | <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:14 | FromDiscord | <Robyn [She/Her]> Didn't Nim use to have header generation built-in? |
23:09:27 | FromDiscord | <ElegantBeef> It still does behind a flag that is not meant to be used nor is supported |
23:12:01 | FromDiscord | <ElegantBeef> It also is not very good |
23:12:09 | FromDiscord | <ElegantBeef> `N_LIB_IMPORT N_CDECL(void, doThing)(NI i_p0);` |
23:19:29 | FromDiscord | <Robyn [She/Her]> Ah |
23:37:47 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=FLNRmkBa |
23:38:09 | FromDiscord | <ElegantBeef> You are not working on typed AST so you'll never see a sym |
23:38:21 | FromDiscord | <sOkam! 🫐> ah that's for sem? kk ty |
23:39:11 | FromDiscord | <sOkam! 🫐> I thought semantics didn't output `PNodes`, though, and it returned `NimNodes` instead |
23:39:27 | FromDiscord | <ElegantBeef> There are no such thing as NimNodes in the compiler |
23:39:40 | FromDiscord | <ElegantBeef> NimNodes are userfacing Pnodes |
23:39:48 | FromDiscord | <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:52 | FromDiscord | <sOkam! 🫐> ah didn't know. makes sense |
23:40:07 | FromDiscord | <ElegantBeef> In reply to @chronos.vitaqua "Unless there's a macro": Except they have no semantic analysis so cannot call macros |
23:40:09 | FromDiscord | <Robyn [She/Her]> `genSym` |
23:40:18 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "Unless there's a macro": metaprogramming in C sounds like ⚰️ |
23:40:24 | FromDiscord | <Robyn [She/Her]> In reply to @elegantbeef "Except they have no": Smh just implement manually |
23:40:33 | FromDiscord | <ElegantBeef> Well they always could make their own types |
23:41:09 | FromDiscord | <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:16 | FromDiscord | <sOkam! 🫐> In reply to @elegantbeef "Well they always could": that would be part of the goal of implementing semantics, yeah |
23:41:36 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "If you use Nim's": except I don't want nim rules, just nim syntax 🤷♂️ |
23:41:46 | FromDiscord | <Robyn [She/Her]> Fair enough |
23:41:57 | FromDiscord | <sOkam! 🫐> I would need to make a backend, not a StoS compiler, for that to be usable |
23:42:08 | FromDiscord | <Robyn [She/Her]> Yeah good point |
23:42:27 | FromDiscord | <Robyn [She/Her]> You could probably support a limited subset of macros that get translated into C source code tbf |
23:42:44 | FromDiscord | <Robyn [She/Her]> But a C preprocessor is closer to a template, right? |
23:42:52 | FromDiscord | <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:00 | FromDiscord | <Robyn [She/Her]> Lol |
23:43:09 | FromDiscord | <sOkam! 🫐> at least the VM has types |
23:43:30 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "But a C preprocessor": it is very similar, yeah, minus the ability to type things |
23:43:34 | FromDiscord | <Robyn [She/Her]> C has types, they can just be ignored xD |
23:43:40 | FromDiscord | <sOkam! 🫐> so its like all untyped, and no introspection |
23:43:49 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "C has types, they": not in macros |
23:43:50 | FromDiscord | <Robyn [She/Her]> Sounds glorious /s |
23:43:55 | FromDiscord | <ElegantBeef> In reply to @heysokam "it is very similar,": If you cannot type things how are the macros written? |
23:44:02 | FromDiscord | <ElegantBeef> 🥁 |
23:44:14 | FromDiscord | <sOkam! 🫐> didn't get the wordplay, lol 😄 |
23:44:25 | FromDiscord | <sOkam! 🫐> was gonna answer, saw the drums... and was like... oh, im dum 😄 |
23:45:02 | FromDiscord | <Robyn [She/Her]> In reply to @elegantbeef "If you cannot type": Zap the ones and zeros onto the harddrive, ez |
23:45:10 | FromDiscord | <ElegantBeef> "Harddrive"? |
23:46:18 | FromDiscord | <sOkam! 🫐> could there be a way to differentiate which `TNodeKind` are used in semantics, and which are in the raw AST? |
23:46:41 | FromDiscord | <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:44 | FromDiscord | <ElegantBeef> To say the unhelpful thing, if it cannot be parsed it will not be matched 😄 |
23:50:51 | FromDiscord | <ElegantBeef> The trick is to just do `else: raise newError(UnimplementedError, "Unimplemented operation for: " & $node.kind")` |
23:59:40 | FromDiscord | <sOkam! 🫐> i mean, that's what I have. but I don't have an `all syntax ever possible` file to parse to find them |