00:13:23 | FromDiscord | <gogolxdong666> What's the position of nimskull? |
00:19:44 | FromDiscord | <Elegantbeef> Join their matrix room and ask there |
00:35:09 | FromDiscord | <System64 ~ Flandre Scarlet> Does Nim supports int128? |
00:36:56 | FromDiscord | <Robyn [She/Her]> In reply to @sys64 "Does Nim supports int128?": Not natively in the stdlib, but you can look at `nint128` |
00:37:36 | FromDiscord | <Robyn [She/Her]> https://github.com/rockcavera/nim-nint128 @System64 ~ Flandre Scarlet |
00:41:46 | FromDiscord | <albassort> what EXACTLY does "hasdatabuffered" mean |
00:42:19 | FromDiscord | <LLM af0rg v2.0> means deez nuts.↵(@albassort) |
00:42:26 | FromDiscord | <albassort> >:( |
00:44:09 | FromDiscord | <LLM af0rg v2.0> wrong room. oops. |
01:14:03 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=lVtnseqEzxmY |
01:14:55 | FromDiscord | <albassort> im going to bed |
01:14:58 | FromDiscord | <albassort> but before that |
01:15:13 | FromDiscord | <albassort> does anyone know why might the server send me a single H in response to a TLS handshake |
01:17:23 | FromDiscord | <albassort> https://media.discordapp.net/attachments/371759389889003532/1237936421147246603/Screenshot_2024-05-09_10-16-36.png?ex=663d75a2&is=663c2422&hm=e06ea774788abba762b44f52b00bcb84ad7ecbf902b69461497b12458a064609& |
01:20:29 | FromDiscord | <albassort> it sends me an infinite supply of nulls |
01:30:08 | FromDiscord | <polylokh_39446> maybe you're writing the server's response to a copied buffer again, and are printing the untouched buffer? |
01:30:47 | FromDiscord | <albassort> How would the H get there when |
01:30:57 | FromDiscord | <albassort> (edit) "when" => "then" |
01:31:26 | FromDiscord | <polylokh_39446> I don't see an H in that buffer |
01:31:34 | FromDiscord | <polylokh_39446> oh, highlighted, on the second line |
01:31:35 | FromDiscord | <albassort> It's highlighted |
01:32:00 | FromDiscord | <albassort> Maybe when I wake up I'll have fresh eyes |
01:32:09 | FromDiscord | <albassort> Or someone for some reason will know how TLS works and health |
01:32:14 | FromDiscord | <polylokh_39446> it can't be sending you a single H in that case, but a bunch of nulls followed by an H, at least that much |
01:32:16 | FromDiscord | <albassort> (edit) "health" => "help" |
01:32:32 | FromDiscord | <albassort> Yeah I don't even know how it would send me that or why |
01:32:38 | FromDiscord | <albassort> Something has to be wrong somewhere on my end |
01:32:40 | FromDiscord | <polylokh_39446> most likely, it's not. |
01:33:08 | FromDiscord | <polylokh_39446> best I can guess is that you're reading a single byte of the response into the middle of that array |
01:33:11 | FromDiscord | <albassort> Perhaps I'm not supposed to simply send the TLs handshake or maybe I collected it wrong because it sent it very fragmented |
01:33:35 | FromDiscord | <polylokh_39446> how/when you start TLS is defined by the protocol. For https it's the first thing you do. |
01:33:54 | FromDiscord | <albassort> Then this is the sel |
01:33:55 | FromDiscord | <albassort> Ssl |
01:34:22 | FromDiscord | <albassort> (edit) "sel" => "ssl" |
01:34:34 | FromDiscord | <polylokh_39446> (an example of starting it later is SMTP, where you connect and be a bit polite and then send STARTSSL) |
01:35:18 | FromDiscord | <albassort> I don't know why the http protocol is like this and I think it's very silly and I would not have designed it like this |
01:35:28 | FromDiscord | <albassort> It seems kind of chaotic |
01:35:34 | FromDiscord | <albassort> At least this side of it |
01:35:55 | FromDiscord | <polylokh_39446> but there shouldn't really be room for error with SSL if you've gotten past really easy mistakes or CA stuff. |
01:36:32 | FromDiscord | <albassort> All I've gotten to is that string there |
01:36:52 | FromDiscord | <polylokh_39446> also, doesn't it say HTTP/1.1 200 OK right there? That's not going to be cleartext with https, it's encrypted too. |
01:37:25 | FromDiscord | <albassort> I don't know I think I've seen that in some wireshark packets |
01:37:26 | FromDiscord | <polylokh_39446> maybe that's the entire response and you're reading garbage memory after it. |
01:37:43 | FromDiscord | <polylokh_39446> there's plenty of cleartext HTTP going around for you to see that |
01:37:46 | FromDiscord | <albassort> No the garbage memory one is the client sending something to the server |
01:38:00 | FromDiscord | <albassort> Server says OK |
01:38:05 | FromDiscord | <albassort> Firefox sends that |
01:38:18 | FromDiscord | <albassort> Sever responds with NULL.... H NULL |
01:38:47 | FromDiscord | <polylokh_39446> `$ strace -vtfff -s100 curl https://somedomain/ 2>&1 | grep HTTP`↵no HTTP on the wire apart from site content that curl prints out |
01:39:04 | FromDiscord | <polylokh_39446> (edit) "HTTP" => ""HTTP"" |
01:39:23 | FromDiscord | <polylokh_39446> with https the entire communication is encrypted. |
01:41:27 | FromDiscord | <polylokh_39446> my new guess is that you're getting the length of the recv wrong. |
01:41:29 | FromDiscord | <albassort> it has to be something to do with the SSL handshake because firefox spits out this |
01:41:37 | FromDiscord | <albassort> sent a long message, see https://pasty.ee/oZhRpbivqnAq |
01:42:17 | FromDiscord | <albassort> In reply to @polylokh_39446 "my new guess is": its seems pretty tolerant to that so far because this is my procedure for that |
01:42:37 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=GplwCGJtVKiB |
01:43:14 | FromDiscord | <albassort> This is somewhat noisey but it doesn't care up to this step |
01:43:28 | FromDiscord | <albassort> however, me reading the response is especially noisey because its fragmented |
01:43:51 | FromDiscord | <polylokh_39446> why are you looping over the indices of data? |
01:43:59 | FromDiscord | <albassort> thats the buggert |
01:44:01 | FromDiscord | <albassort> (edit) "buggert" => "buffer" |
01:44:11 | FromDiscord | <albassort> its reading into the buffer |
01:44:12 | FromDiscord | <polylokh_39446> you're recv'ing single bytes? why? |
01:44:27 | FromDiscord | <albassort> temporary easiest way to break when its null |
01:45:12 | FromDiscord | <albassort> i could refine it when it works but making it do say 24 bytes would make it more complicated |
01:45:31 | FromDiscord | <polylokh_39446> what you do is pick a buffer size and let recv fill as much of it as it wants |
01:46:04 | FromDiscord | <polylokh_39446> recv tells you how much it wrote into the buffer. You can then consider that sub array. |
01:46:41 | FromDiscord | <albassort> In reply to @polylokh_39446 "what you do is": hmm i was afraid of data loss but you're right |
01:46:58 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=piquWeAhhBYn |
01:47:08 | FromDiscord | <albassort> (edit) "https://play.nim-lang.org/#pasty=LQTFuCKSnztX" => "https://play.nim-lang.org/#pasty=gNAEfWeNGOWR" |
01:47:12 | FromDiscord | <polylokh_39446> this is something that could technically work, but is also such a crazy thing to do from the perspective of the BSD socket API, that I think it's only natural for weird errors to crop up. |
01:47:27 | FromDiscord | <Elegantbeef> `$char(ord(0x0)` what the fuck over |
01:47:33 | FromDiscord | <albassort> YES |
01:47:35 | FromDiscord | <albassort> (edit) "YES" => "yes" |
01:47:40 | FromDiscord | <Elegantbeef> That's gotta be the most complicated way to write `"\0"` |
01:47:41 | FromDiscord | <leorize> why would you want to break on nul? |
01:47:51 | FromDiscord | <albassort> end of message usually |
01:48:00 | FromDiscord | <leorize> binary data contains 0 all the time |
01:48:08 | FromDiscord | <albassort> well its not binary |
01:48:11 | FromDiscord | <albassort> its http most of the time |
01:48:13 | FromDiscord | <albassort> not here, though |
01:48:16 | FromDiscord | <Elegantbeef> It's encrypted no? |
01:48:21 | FromDiscord | <albassort> errr |
01:48:23 | FromDiscord | <albassort> we're not sure |
01:48:26 | FromDiscord | <polylokh_39446> you don't need end of message with sockets in general, and HTTP gives you a content-length header, and HTTP responses can include NUL bytes naturally, for example if you download a big-file-of-nulls.bin |
01:49:30 | FromDiscord | <leorize> and encrypted stuff is supposed to be indistinguishable from random data |
01:49:30 | FromDiscord | <leorize> and last time I checked random includes 0 |
01:49:30 | FromDiscord | <Elegantbeef> No then it wouldn't be random if you knew what it contained 😛 |
01:50:05 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=EtJVNkKjqjPN |
01:50:10 | FromDiscord | <albassort> no content-length here |
01:50:18 | FromDiscord | <polylokh_39446> if you get to pulling out your hair, try just running through Beej's Guide with Nim. Write simple networking programs with std/selectors and non-async calls, and get comfortable with how that works. The SSL experience should be "you wrap a socket with a context and it just works" |
01:50:33 | FromDiscord | <albassort> I've been coding in nim for like |
01:50:35 | FromDiscord | <albassort> 4 years now |
01:50:38 | FromDiscord | <leorize> if you don't have content-length, then it's deliminated by connection termination |
01:50:48 | FromDiscord | <leorize> welcome to http/1.1 |
01:50:50 | FromDiscord | <albassort> This is my first interaction with http |
01:50:52 | FromDiscord | <leorize> well, 1.0 tbf |
01:50:53 | FromDiscord | <albassort> not nim |
01:51:00 | FromDiscord | <polylokh_39446> Beej's Guide is a BSD socket guide, not a Nim guide. I'm not asking you to read a Nim tutorial |
01:51:09 | FromDiscord | <albassort> sorry i misunderstood |
01:51:15 | FromDiscord | <albassort> yes maybe that would be helpful lol |
01:51:46 | FromDiscord | <leorize> typically all networking protocol have the idea of a "frame" |
01:51:54 | FromDiscord | <albassort> In reply to @leorize "welcome to http/1.1": wait a second you motherfucker no connection terminates here! |
01:52:00 | FromDiscord | <leorize> which tells you how much data is in a "packet" or "message" |
01:52:15 | FromDiscord | <albassort> because its a CONNECT |
01:52:18 | FromDiscord | <albassort> its keep alive |
01:52:24 | FromDiscord | <albassort> it ends when it wants to end |
01:53:31 | FromDiscord | <leorize> same thing, how is your connection framed? |
01:53:39 | FromDiscord | <leorize> not by nul, certainly |
01:53:49 | FromDiscord | <albassort> \r\n\r\n |
01:54:01 | FromDiscord | <albassort> is the pattern i've seen |
01:54:21 | FromDiscord | <leorize> nope, once connect is established, it's just free form data both ways |
01:54:30 | FromDiscord | <polylokh_39446> the HTTP header and the payload are separated by a blank line. That's not the end of the connection. |
01:54:38 | FromDiscord | <albassort> oh |
01:54:42 | FromDiscord | <albassort> uhh |
01:54:44 | FromDiscord | <albassort> im not there yet |
01:55:08 | FromDiscord | <albassort> I haven't made it to the natural end of a CONNECT because of my silly socket programming it seems |
01:55:28 | FromDiscord | <leorize> the natural end is when one of the endpoint disconnect from my quick spec skim |
01:55:39 | FromDiscord | <albassort> yeah that was what i was going to program for |
01:55:44 | FromDiscord | <leorize> that's what I meant by "termination is delimination" |
01:55:47 | FromDiscord | <albassort> In reply to @leorize "the natural end is": send spec |
01:56:26 | FromDiscord | <albassort> I've just been going off reading bytes like im trying to decode a proprietary algorithm because I couldn't find a coherent low level spec |
01:56:48 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#pasty=sIhCaYgARhRF |
01:56:49 | FromDiscord | <leorize> https://httpwg.org/specs/rfc9110.html#CONNECT |
01:56:57 | FromDiscord | <leorize> https://httpwg.org/specs/ |
01:58:09 | FromDiscord | <albassort> ok so it looks like i need to investigate http1/1 specifically |
02:00:19 | FromDiscord | <leorize> static seq typically doesn't make any sense↵(@user2m) |
02:01:01 | FromDiscord | <albassort> In reply to @leorize "static seq typically doesn't": usually it would be an array[char] if it was static |
02:01:28 | FromDiscord | <leorize> openArray is better if you want arbitrary length |
02:01:41 | FromDiscord | <albassort> static means compile defined, and that would mean you would have no need for most of the features of a SEQ and so you would use an array. If its static, it also cannot change its length |
02:02:28 | FromDiscord | <albassort> i cant wait to program the SOCKS5 proxy |
02:02:29 | FromDiscord | <leorize> `openArray[char]` is compatible with `array[I, char]`, `seq[char]` and `string` |
02:02:34 | FromDiscord | <albassort> (edit) "i cant wait to program the SOCKS5 ... proxy" added "and shadowsocks" |
02:02:37 | FromDiscord | <albassort> (edit) "proxy" => "proxy. I think it'll be easier" |
02:02:39 | FromDiscord | <leorize> basically an all-in-one solution |
02:03:17 | FromDiscord | <leorize> though for stuff like "allowed\_symbols", `set[char]` is very useful thanks to O(1) lookups |
02:12:02 | FromDiscord | <user2m> In reply to @leorize "though for stuff like": ahhh very clever indeed thank you! |
02:22:23 | * | def- quit (Quit: -) |
02:22:46 | * | def- joined #nim |
03:04:35 | * | pbsds3 quit (Quit: The Lounge - https://thelounge.chat) |
04:13:35 | FromDiscord | <planetis_m> sent a code paste, see https://play.nim-lang.org/#pasty=vwdDAjUFoxCZ |
04:17:12 | FromDiscord | <Elegantbeef> Could turn the operators into `codegendecl` |
04:17:16 | FromDiscord | <Elegantbeef> or rather `emit` |
04:18:00 | FromDiscord | <planetis_m> though so emit is my best option, thanks beef |
04:18:53 | FromDiscord | <Elegantbeef> Does `importcpp` work with `importC`? |
04:19:39 | FromDiscord | <planetis_m> I tried it early on and stoped since it forces compilation to C++ |
04:27:41 | FromDiscord | <ringabout> Does variables of iterators leak into the current scope? It seems to disrupt enums |
04:27:56 | FromDiscord | <ringabout> (edit) "of" => "in the inline" | "enums" => "enums." |
04:29:58 | FromDiscord | <polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=TSbcyHpLkSif |
04:31:17 | FromDiscord | <polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=hEbJCosBgHrP |
04:31:36 | FromDiscord | <polylokh_39446> (edit) "https://play.nim-lang.org/#pasty=YSIdSFViQNEb" => "https://play.nim-lang.org/#pasty=PEHNJVjXuIQU" |
04:53:46 | * | rockcavera quit (Remote host closed the connection) |
05:51:49 | * | def- quit (Quit: -) |
05:52:34 | * | def- joined #nim |
06:02:59 | * | def- quit (Quit: -) |
06:04:14 | * | def- joined #nim |
06:51:44 | FromDiscord | <Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=evClOJfDpNLH |
06:51:48 | FromDiscord | <Robyn [She/Her]> (edit) "https://play.nim-lang.org/#pasty=GlAsjqwddGVI" => "https://play.nim-lang.org/#pasty=eLmaeVNJZbeY" |
06:52:14 | FromDiscord | <Robyn [She/Her]> This is fun... /s↵I'm trying to use Futhark's project to wrap Binaryen but failing |
07:05:51 | FromDiscord | <Elegantbeef> You do realise binaryen uses C++ right? |
07:06:31 | FromDiscord | <Elegantbeef> https://github.com/WebAssembly/binaryen/blob/main/src/binaryen-c.h exists |
07:08:38 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "You do realise binaryen": It was C headers, that's why I'm using Futhark |
07:09:09 | FromDiscord | <Robyn [She/Her]> Oh wait |
07:09:11 | FromDiscord | <Elegantbeef> No they are not |
07:09:19 | FromDiscord | <Robyn [She/Her]> The `.h` files are C++ headers, aren't they? |
07:09:24 | FromDiscord | <Robyn [She/Her]> Besides the `-c` file |
07:09:36 | FromDiscord | <Robyn [She/Her]> In reply to @chronos.vitaqua "The `.h` files are": I hate that they're using the same file extension |
07:09:43 | FromDiscord | <Elegantbeef> Unless C added namespaces inbetween the last time that I looked and now |
07:09:49 | FromDiscord | <Elegantbeef> hpp really should be standard 😄 |
07:11:43 | FromDiscord | <Robyn [She/Her]> Yeaah |
07:16:24 | Amun-Ra | hpp looks ugly as, I'm for cc and hh |
07:16:26 | Amun-Ra | :) |
07:16:41 | FromDiscord | <Elegantbeef> Good thing it's a file extension so it does not matter if it's ugly |
07:17:35 | Amun-Ra | I trolled my prof once - I had foo.c (C) and foo.C (C++) in my project and he used windows |
07:17:42 | Amun-Ra | that did not end well |
07:22:45 | Amun-Ra | (.C was quite popular in the old days) |
08:14:17 | * | beholders_eye joined #nim |
08:28:37 | NimEventer | New thread by MauroG: Using threads with gui Nigui, see https://forum.nim-lang.org/t/11575 |
09:14:02 | * | krux02 joined #nim |
09:18:33 | * | gst joined #nim |
09:42:46 | * | ntat joined #nim |
09:50:05 | * | coldfeet joined #nim |
10:12:48 | * | beholders_eye quit (Ping timeout: 252 seconds) |
10:14:46 | * | beholders_eye joined #nim |
10:27:56 | FromDiscord | <sOkam! 🫐> `proc thing(_: void): void= ... `↵Is this the way to make "no arguments" explicit in nim, as you would say `thing(void)` in C |
10:28:01 | FromDiscord | <sOkam! 🫐> (edit) "C" => "C?" |
10:28:25 | Amun-Ra | proc () |
10:28:34 | FromDiscord | <sOkam! 🫐> > "explicit" |
10:29:19 | Amun-Ra | this is explicit definition |
10:30:13 | Amun-Ra | I don't think you can have C-like implicit definitions in nim |
10:30:16 | FromDiscord | <sOkam! 🫐> `thing()` is implicit, `thing(void)` is explicit. both work in C↵`proc () = ` is implicity void return, `proc () :void=` is explicit void return↵I'm trying to do the same in nim but for args |
10:30:35 | Amun-Ra | ah, sorry, I thought you wanted that in nim |
10:31:15 | FromDiscord | <sOkam! 🫐> yes, i want `thing(void)` in nim, and `proc thing()` is implicit void args in nim, even if it works its still implicit |
10:31:24 | Amun-Ra | proc () is explicit in nim |
10:32:02 | FromDiscord | <sOkam! 🫐> i think that's not the definition of explicit, since you are omitting words |
10:32:16 | Amun-Ra | that does not follow |
10:32:35 | FromDiscord | <odexine> there is no explicit version. the only way to provide void arguments in nim is by "implicit" |
10:32:52 | FromDiscord | <odexine> the only reason there is an explicit and implicit way to define arguments in C is historical |
10:33:09 | FromDiscord | <sOkam! 🫐> that example with `(_: void)` does compile, btw, without passing any args. but it felt weird, so figure I should ask |
10:33:30 | FromDiscord | <odexine> then i'd say that is the way to define explicit 0 args |
10:33:37 | Amun-Ra | odexine: it's the other way around |
10:33:50 | FromDiscord | <odexine> even though it is arguably less clear than the implicit way |
10:33:59 | FromDiscord | <odexine> In reply to @Amun-Ra "<@259277943275126785>: it's the other": which is? |
10:34:08 | Amun-Ra | implicit declaration is the one with arguments ommited |
10:34:16 | FromDiscord | <sOkam! 🫐> yeah, explicit was added to C because implicit could mean "variable number of args" before explicit void was added to C |
10:34:43 | FromDiscord | <odexine> In reply to @Amun-Ra "implicit declaration is the": yes, i dont see how that contradicts what i said |
10:34:56 | Amun-Ra | odexine | there is no explicit version. the only way to provide void arguments in nim is by "implicit" |
10:35:30 | FromDiscord | <odexine> okay, where is the contradiction there |
10:35:31 | Amun-Ra | I guess we differ what type () is… :P |
10:35:48 | FromDiscord | <odexine> i'm using sokam's terminology |
10:35:59 | Amun-Ra | for example, () in C++ is explicit |
10:36:12 | FromDiscord | <odexine> to me there is no agreed-upon definition for "explicit" "implicit" |
10:39:11 | Amun-Ra | tbh implicit/explicit means something slightly different than what we've talked above; it's about calling function without previous prototype or declaration |
10:42:12 | Amun-Ra | for me nim's foo() has arguments declared explicitely because () in nim has different meaning than C89 style "any number of arguments" |
10:50:24 | * | madprops left #nim (Leaving) |
11:27:58 | NimEventer | New thread by thedistantforest: Single parameter version of varargs, see https://forum.nim-lang.org/t/11576 |
11:28:37 | FromDiscord | <odexine> what does that title even mean what |
11:28:44 | FromDiscord | <odexine> oh |
11:42:58 | * | coldfeet quit (Remote host closed the connection) |
11:43:57 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#pasty=yCjgDhhU |
11:44:03 | FromDiscord | <Phil> Though the same should also work on gcc |
11:44:16 | FromDiscord | <Phil> (edit) "gcc" => "gcc, as in, it should similarly throw compiler errors" |
11:49:43 | FromDiscord | <sOkam! 🫐> In reply to @isofruit "Can somebody (on Linux!)": https://media.discordapp.net/attachments/371759389889003532/1238095550767693924/image.png?ex=663e09d6&is=663cb856&hm=6f66ecefd05a0eb7e598e3f0494624cb18c527483e8a91a4573c7afd2b2ddc6c& |
11:50:08 | FromDiscord | <Phil> Could you show the compilation commadn to make sure it includes the flags? |
11:50:26 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=aJXZuLih |
11:50:45 | FromDiscord | <sOkam! 🫐> (edit) "https://play.nim-lang.org/#pasty=BXLhfDfK" => "https://play.nim-lang.org/#pasty=blskXpLy" |
11:51:06 | FromDiscord | <sOkam! 🫐> _(ignore my weird local-only setup, im just compiling with a bootstrapped nim)_ |
11:51:21 | FromDiscord | <Phil> How long have you had threading installed? Mostly asking because your threading package has a different hash than mine |
11:51:44 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=ovSBJUjC |
11:51:53 | FromDiscord | <sOkam! 🫐> In reply to @isofruit "How long have you": never used it before until you asked |
11:52:37 | FromDiscord | <sOkam! 🫐> everytime you install a library it adds a different hash to the folder |
11:57:03 | FromDiscord | <Phil> In reply to @heysokam "everytime you install a": Afaik it's only if there's actual changes in the lib that weren't expressed in the source folder, determined by hashing the lib after download |
11:57:30 | FromDiscord | <sOkam! 🫐> 🤷♂️ i never understood nimble anyway, so I have no clue |
11:57:55 | FromDiscord | <sOkam! 🫐> do you want me to manually clone a specific version or something? |
11:58:24 | FromDiscord | <Phil> No, it's fine. This confirms with me that it's a specific interim version of the threading package |
11:58:38 | FromDiscord | <Phil> And that sth was merged which didn't lead to a version bump afterwards |
11:59:00 | FromDiscord | <Phil> Leading to now different "versions" of threading 0.2.0 floating around, one of which is buggy, but thankfully that is the "older" one |
11:59:45 | FromDiscord | <sOkam! 🫐> are there two git tags of 0.2.0? afaik nimble works only off of tags, ignoring commits |
12:00:08 | FromDiscord | <sOkam! 🫐> _(unless `#head` is passed, ofc)_ |
12:00:36 | FromDiscord | <Phil> Apparently not, the threading repo has 0 git tags |
12:01:43 | FromDiscord | <Phil> I assume it uses git tags as a first preference for determining "checkpoints" ala "0.2.0 is the lib at the commit tagged as 0.2.0" and has various fallback behaviors when there are not git tags |
12:08:13 | NimEventer | New thread by ingo: Forward declare and extend object (I know it does not work), see https://forum.nim-lang.org/t/11577 |
12:24:18 | * | beholders_eye quit (Ping timeout: 255 seconds) |
12:33:18 | * | Jhonny2x4 quit (Quit: Jhonny2x4) |
12:33:40 | * | Jhonny2x4 joined #nim |
12:55:51 | * | nyeaa49284230101 quit (Ping timeout: 272 seconds) |
13:06:02 | FromDiscord | <Robyn [She/Her]> In Nim, are loops expressions and can they return a value? |
13:06:49 | FromDiscord | <solitudesf> nope |
13:07:35 | FromDiscord | <Robyn [She/Her]> Thanks, how about named functions? `proc myName(): int = 6` and type definitions? |
13:07:40 | FromDiscord | <Robyn [She/Her]> Assuming no for both |
13:07:43 | FromDiscord | <solitudesf> In reply to @chronos.vitaqua "In Nim, are loops": you can emulate that, for example sugar/collect does it |
13:08:18 | FromDiscord | <nervecenter> In reply to @chronos.vitaqua "In Nim, are loops": Yeah `std/sugar.collect()` can do that |
13:08:39 | FromDiscord | <Robyn [She/Her]> I'm just wondering rn, since talk of expressions > statements came up in a server I'm in |
13:09:17 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=JZUVjqhb |
13:10:28 | FromDiscord | <nervecenter> In reply to @chronos.vitaqua "I'm just wondering rn,": I definitely prefer expression-based programming having spent a lot of time with Lisp, and Nim seems to prefer it whenever possible, which is nice. Method-style stateful semantics are very uncommon in the standard library or any other library for that matter. |
13:11:45 | FromDiscord | <odexine> In reply to @chronos.vitaqua "Thanks, how about named": neither are expressions if i understand correctly |
13:13:46 | FromDiscord | <the_real_hypno> Kd |
13:13:59 | FromDiscord | <the_real_hypno> Woops, my mobile fell out of my hands |
13:14:28 | FromDiscord | <the_real_hypno> (edit) "hands" => "hands, ignore the "kd" 😛" |
13:15:46 | FromDiscord | <Robyn [She/Her]> In reply to @odexine "neither are expressions if": Thanks |
13:16:14 | FromDiscord | <Robyn [She/Her]> In reply to @nervecenter "I definitely prefer expression-based": Understandable, tbh I never was into functional programming before so I take these small features for granted when going back to other langs |
13:16:50 | FromDiscord | <odexine> i really like for loops as expressions (ehem the 6 letter name that starts with e) |
13:18:08 | FromDiscord | <Robyn [She/Her]> Elíxir lmao |
13:20:07 | FromDiscord | <odexine> dont say that wtf |
13:20:09 | FromDiscord | <odexine> shhh |
13:23:10 | FromDiscord | <Robyn [She/Her]> Lmao |
13:30:22 | FromDiscord | <System64 ~ Flandre Scarlet> Erlang? |
13:34:49 | * | rockcavera joined #nim |
13:47:34 | FromDiscord | <odexine> erlang also has for loop expressions iirc |
14:04:11 | * | beholders_eye joined #nim |
14:24:33 | FromDiscord | <System64 ~ Flandre Scarlet> https://github.com/treeform/vmath↵@treeform Does it support operations on CPU too? |
14:25:47 | FromDiscord | <Robyn [She/Her]> Random question: How does a BVec work exactly? :P |
14:30:33 | FromDiscord | <demotomohiro> for loop itself cannot be an expression in Nim but there is `forExpr` in grammer: https://nim-lang.org/docs/manual.html#syntax-grammar |
14:31:37 | FromDiscord | <treeform> In reply to @sys64 "https://github.com/treeform/vmath <@107140179025735": Vmath only supports the CPU? Your might be thinking of https://github.com/treeform/shady which does some GPU magic as well. |
14:31:52 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "Vmath only supports the": Oh alright, thanks, |
14:31:56 | FromDiscord | <System64 ~ Flandre Scarlet> ! |
14:42:50 | FromDiscord | <the_real_hypno> Why the Elixir hate? Is it that bad? |
14:44:00 | FromDiscord | <the_real_hypno> Kinda feels like im reading a c++ channel, not a Nim one |
14:47:07 | * | beholders_eye quit (Ping timeout: 268 seconds) |
14:49:31 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "Vmath only supports the": Just a question, why making multiple vector types instead of generics? |
14:53:37 | FromDiscord | <treeform> Two big reasons: |
14:53:51 | FromDiscord | <treeform> Its what GLSL does, so if you have GLSL code laying around its easy to port. |
14:54:20 | FromDiscord | <treeform> Its way easier man. Typing [float32] everywhere gets really old! |
14:54:52 | FromDiscord | <treeform> It has generic `gvec3[float64]` versinos of everything if you want. |
14:55:15 | FromDiscord | <treeform> I think I have a text that create a fixed point type and uses that instead. |
14:56:16 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "I think I have": Oh alright↵And is there converters? |
14:56:55 | * | beholders_eye joined #nim |
15:03:01 | FromDiscord | <treeform> vec3 = gvec3[float32] |
15:03:07 | FromDiscord | <treeform> no need to convert its just a type alias |
15:03:23 | FromDiscord | <treeform> you mean about the fix point |
15:03:29 | FromDiscord | <treeform> yes I think I have converters |
15:04:15 | FromDiscord | <treeform> I think I did not commit the fix point stuff sorry I probalby did not like it |
15:07:16 | * | ntat quit (Ping timeout: 256 seconds) |
15:08:08 | * | ntat joined #nim |
15:09:53 | FromDiscord | <Robyn [She/Her]> In reply to @demotomohiro "for loop itself cannot": Oh? Is there a node for it though in the AST? |
15:12:45 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "vec3 = gvec3[float32]": Does it also work with 2d vectors? |
15:14:41 | FromDiscord | <treeform> Yes it has vec2, vec4, mat3 and mat4, and quats |
15:17:06 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "Yes it has vec2,": Oh alright so I can just do vec2[uint16] and use the functions? Nice! |
15:17:35 | FromDiscord | <treeform> yes that's right! `gvec2[uint16]` should work |
15:18:35 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#pasty=IhfnbGwG |
15:18:44 | FromDiscord | <treeform> (edit) "https://play.nim-lang.org/#pasty=dORVyBmd" => "https://play.nim-lang.org/#pasty=GpibVkdX" |
15:18:55 | FromDiscord | <treeform> that's how UVec2 is made |
15:19:17 | FromDiscord | <treeform> https://github.com/treeform/vmath/blob/master/src/vmath.nim#L378 |
15:19:34 | FromDiscord | <treeform> If you follow that patter and define some helper methods you can have gvec2[uint16] type everywhere |
15:19:41 | FromDiscord | <treeform> (edit) "patter" => "pattern" |
15:20:52 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "If you follow that": Oh alright↵I guess it's the same for Matrices? |
15:22:19 | FromDiscord | <System64 ~ Flandre Scarlet> I wanted to make my own vector library, but seems this one fulfills my needs↵However no idea what happens if you try to normalize a vector of ints |
15:23:21 | FromDiscord | <treeform> you get unit vector in one direction? |
15:23:31 | FromDiscord | <treeform> only +1 and -1 in either x,y,z allowed |
15:24:38 | FromDiscord | <treeform> I think you will have a ton of problems using vec2[uint16] as most stuff with sin/cos will not work. |
15:25:06 | FromDiscord | <treeform> Nim would throws errors like sin(uint16) or sqrt(uint16) not defined... |
15:25:52 | FromDiscord | <System64 ~ Flandre Scarlet> Makes sense↵↵And fixed points are not supported? |
15:30:23 | FromDiscord | <albassort> In reply to @polylokh_39446 "recv tells you how": it doesn't seem to |
15:32:15 | FromDiscord | <albassort> recv, if there it reaches EOF will wait, and if its interrupted, it will return 0 even if it read data to the buffer |
15:32:52 | FromDiscord | <albassort> in effect, it either echos 0 or size |
15:33:04 | FromDiscord | <albassort> (edit) "echos" => "returns" |
15:51:09 | FromDiscord | <treeform> In reply to @sys64 "Makes sense And": yes, I had a brach with fixed point, but it did not work out. |
15:51:45 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "yes, I had a": Oh alright↵Fixed is tricky |
15:51:49 | FromDiscord | <treeform> (edit) "brach" => "branch" |
15:52:24 | FromDiscord | <treeform> Yes I think I tired 32 bit fixed point though 16bit before and 16 bit after decimal. |
15:52:34 | FromDiscord | <treeform> I think I also tried float16 |
15:52:42 | * | gst quit (Quit: Client closed) |
15:52:43 | FromDiscord | <treeform> but did not finish |
15:53:01 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "I think I also": Float16?! Nim has that?! |
15:53:06 | FromDiscord | <treeform> no |
15:53:13 | FromDiscord | <treeform> I tired to make one for nim though |
15:53:36 | FromDiscord | <treeform> float16 computed mostly in software |
15:53:44 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "I tired to make": Oh alright↵But what are Float16 useful for? |
15:53:46 | FromDiscord | <treeform> but would call to float32 for sin/cos/sqrt etc.. |
15:54:02 | FromDiscord | <treeform> Float16 are used for Machine Learning |
15:54:11 | FromDiscord | <System64 ~ Flandre Scarlet> Oh! |
15:54:21 | FromDiscord | <treeform> There is also bfloat16 varient |
15:54:30 | FromDiscord | <System64 ~ Flandre Scarlet> What is that? |
15:54:39 | FromDiscord | <treeform> a different kind of float in 16 bits |
15:54:51 | FromDiscord | <System64 ~ Flandre Scarlet> Oh↵And float8? |
15:54:53 | FromDiscord | <treeform> float16 matches float32 as much as it can |
15:55:00 | FromDiscord | <treeform> and bfloat16 does its own thing |
15:55:30 | FromDiscord | <treeform> I don't think there is a float8 standard |
15:55:49 | FromDiscord | <treeform> at 8 bit level you go for quantinization |
15:55:57 | FromDiscord | <treeform> were you have a row of floats |
15:56:12 | FromDiscord | <treeform> first byte is the scale and the next bytes are the integer parts of many floats |
15:56:53 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "first byte is the": So the integer are multiplied by the scale? |
15:58:15 | FromDiscord | <treeform> its a bit more complex: here is a decent explanation: https://towardsdatascience.com/quantize-llama-models-with-ggml-and-llama-cpp-3612dfbcc172 |
15:58:35 | FromDiscord | <System64 ~ Flandre Scarlet> Gotta have a look asap |
15:58:54 | FromDiscord | <treeform> You have like Q2_K Q3_K Q4_K Q5_K ... types |
15:58:55 | * | beholders_eye quit (Ping timeout: 246 seconds) |
15:59:03 | FromDiscord | <treeform> And they are different per layer |
16:09:27 | FromDiscord | <odexine> In reply to @the_real_hypno "Why the Elixir hate?": more just that i mention it too much lol |
16:10:17 | FromDiscord | <the_real_hypno> In reply to @odexine "more just that i": Ah i see, so no c++ channel 😛 |
16:10:37 | FromDiscord | <ieltan> @nocturn9x Hey sorry to ping you, have you resolved your threading issues with Nim ? asking for educational purposes |
16:11:24 | FromDiscord | <System64 ~ Flandre Scarlet> is doing something like MyType.doSomething(myArgument) Nim idiomatic? |
16:11:33 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "MyType.doSomething(myArgument)" => "``MyType.doSomething(myArgument)``" |
16:13:38 | FromDiscord | <nocturn9x> In reply to @ieltan "<@523555920265871380> Hey sorry to": yes |
16:15:53 | FromDiscord | <nocturn9x> sent a long message, see https://paste.rs/vDXvS |
16:16:05 | FromDiscord | <nocturn9x> (edit) "https://paste.rs/cLGj1" => "https://paste.rs/CylLC" |
16:16:37 | FromDiscord | <nocturn9x> (edit) "https://paste.rs/ETdK1" => "https://paste.rs/xTUEr" |
16:17:06 | FromDiscord | <nocturn9x> This was also probably just part of the problem. Switching away from references and using -d:useMalloc surely helped |
16:18:19 | FromDiscord | <ieltan> In reply to @nocturn9x "the issue was (I": I see, that's some pretty obscure bug wth lol |
16:18:42 | FromDiscord | <ieltan> i'll take note of that gotcha thanks 🙂 |
16:19:42 | FromDiscord | <ieltan> In reply to @nocturn9x "This was also probably": so yeah i figured that `ref` is utterly useless when you need to share memory across thread |
16:19:50 | FromDiscord | <ieltan> you're using minalloc right |
16:21:58 | FromDiscord | <threefour> Didn't ARC/ORC change it so that refs can be shared between threads via shared heap? Or is that only ptrs? |
16:25:28 | * | wheatengineer joined #nim |
16:30:24 | FromDiscord | <ieltan> In reply to @threefour "Didn't ARC/ORC change it": afaik atomic ref only partially solves the issue of sharing memory between threads where you still need to ensure it's writing/reading protected |
16:32:04 | FromDiscord | <ieltan> nim approach to this is to try and ensure unique ownership using construct like `isolate` or `isUniqueRef` matt's issue is that he require shared ownership so it goes against nim's design this is why i was interested in how he managed to make it work anyways |
16:32:12 | FromDiscord | <ieltan> (edit) "construct" => "constructs" |
16:37:06 | FromDiscord | <System64 ~ Flandre Scarlet> Is it normal it shows error while the library is installed? https://media.discordapp.net/attachments/371759389889003532/1238167875152379904/image.png?ex=663e4d31&is=663cfbb1&hm=2fbd11e4ab229efda301e7764393ccf237113640b5f687c1ebacc1ff5cfd5f6c& |
16:40:20 | FromDiscord | <ieltan> In reply to @sys64 "Is it normal it": if you've just installed it then reload vscode, otherwise i aint got a clue |
16:41:32 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "if you've just installed": Even that didn't worked |
16:53:32 | * | wheatengineer quit (Ping timeout: 268 seconds) |
17:39:33 | * | disso-peach joined #nim |
17:48:27 | * | wheatengineer joined #nim |
18:21:32 | * | wheatengineer quit (Quit: Leaving) |
18:24:02 | FromDiscord | <Phil> In reply to @threefour "Didn't ARC/ORC change it": Yes, they now technically can. At the same time, unless the kind of multithreading you want is threadpool where you're happy to wait until the threadpool has chunked through all the tasks in parallel and then continue, you're currently not in a happy place with nim |
18:25:29 | FromDiscord | <Phil> There is not yet anything that I'd call an easy-to-use actor implementation (which is typically what you'd want for a GUI application where the main thread is in a loop and should just outsource certain tasks to other threads that then eventually send a message back if necessary |
18:25:46 | FromDiscord | <Phil> (edit) "necessary" => "necessary)" |
18:29:12 | FromDiscord | <Phil> It's also very tricky because the only safe way to do so is by using "isolate", aka proving that your current thread does not hold a reference to whatever you're passing on to the next thread.↵Because nim will absolutely try to call =destroy on that ref when it goes out of scope in your current thread, which will lead to data-races with whenever the other thread calls =destroy on that ref, which may just randomly segfault your applic |
18:32:52 | FromDiscord | <Phil> In reply to @ieltan "nim approach to this": It's not just matt's issue. In my opinion the idea behind isolate just fundamentally doesn't work.↵You can't just assume that if you want to send a message from A to B that you can have all the data neatly instantiated within an isolate call. That assumption makes no sense.↵I don't necessarily have a better solution, but std/isolation is not it. |
18:40:03 | * | ntat quit (Quit: Leaving) |
18:54:46 | FromDiscord | <System64 ~ Flandre Scarlet> Is there an objet in Nim that allows you to have a pointer to data, and a length?↵Like a seq, but I can input the pointer and the length myself |
18:55:57 | FromDiscord | <Phil> I'm not aware of one specifically in nim. I mean, you can write your own, it's just an object afterall |
18:56:40 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @isofruit "I'm not aware of": Oh alright↵But is it possible to give it the OpenArray properties?↵So if a proc asks for an OpenArray, I can pass this object |
18:56:50 | FromDiscord | <Phil> Beyond me |
18:57:10 | FromDiscord | <Phil> Never tried it and openarray is one of those things I basically never use, my C interop is too lacking |
19:00:31 | FromDiscord | <System64 ~ Flandre Scarlet> thanks anyways |
19:00:47 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/mbP9c |
19:07:46 | * | def- quit (Quit: -) |
19:08:36 | * | def- joined #nim |
19:14:19 | FromDiscord | <Robyn [She/Her]> In reply to @sys64 "Oh alright But is": Implement all the methods that a seq implements and you should be good |
19:18:16 | FromDiscord | <threefour> In reply to @isofruit "It's not just matt's": Is an "actor" model something that can be implemented outside of the core language? Not an expert on advanced parallel concepts, nor Nim, so I'm curious. |
19:19:25 | FromDiscord | <Phil> In reply to @threefour "Is an "actor" model": I'm not an expert either.↵The "Actor" model is just a "way" that you can do concurrency. It's all about having theads and queues and implementing their interaction correctly |
19:19:26 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/KeVdb |
19:19:49 | FromDiscord | <Phil> It's just there to make interaction between threads and queues easier |
19:20:19 | FromDiscord | <threefour> In reply to @isofruit "I'm not an expert": Right, which sounds like it should be possible to make a library that makes this easier. |
19:20:23 | FromDiscord | <Phil> Or rather between threads, you typically abstract away the queues by claiming they're "Mailboxes" where you send messages to |
19:20:35 | FromDiscord | <Phil> Oh absolutely, the thing is that that is hard as fuck 😄 |
19:20:52 | FromDiscord | <System64 ~ Flandre Scarlet> What exception is used for seq out of bounds? |
19:21:56 | FromDiscord | <threefour> `IndexDefect`? |
19:22:13 | FromDiscord | <Phil> Particularly to do correctly.↵I have an inkling on how it could work, but that is going to take various shortcuts because trying to do the perfect way (moving a ref from one thread to another) in a way that makes sense requires a level of expertise in nim's memory management and hooks that I do not have. |
19:24:09 | FromDiscord | <Phil> The shortcut-version is that you don't move messages - you deep copy them instead. Then you still have to deal with a queue that one thread pushes messages into while the other reads from it and you need to manage accessing it, but that is infinitely easier than trying to do that and on top of that deal with the problem "How do you guarantee that a message you receive absolutely definitely does not have a ref that is also accessed elsewh |
19:24:11 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @threefour "`IndexDefect`?": Oh thanks↵and to check if the build is a danger build? |
19:24:37 | FromDiscord | <Phil> Together with the problem of "How do you guarantee that the message does not get nim's `=destroy` hook called on it in Thread A after it was moved to Thread B |
19:24:51 | FromDiscord | <threefour> Makes sense. Wasn't sure if it was a language limitation. |
19:24:53 | FromDiscord | <Phil> I do not have decent answers for either of those problems and I've hit my head enough against the wall to say I no longer care to find them |
19:25:08 | FromDiscord | <Phil> Maybe it isn't, I'm just saying I can't figure it out |
19:26:09 | FromDiscord | <Phil> (edit) "The shortcut-version is that you don't move messages - you deep copy them instead. Then you still have to deal with" => "sent" | "queue that one thread pushes messages into while the other reads from it and you need to manage accessing it, but that is infinitely easier than trying to do that and on top of that deal with the problem "How do you guarantee that a message you receive absolutely definitely does not have a ref that is |
19:27:02 | FromDiscord | <Phil> The entire "How do I figure out that Thread A, after having passed on the message, has absolutely no way to access any of the data that is in the message" problem is in fact so hard that from what I can tell even Araq threw in the towerl |
19:27:04 | FromDiscord | <Phil> (edit) "towerl" => "towel" |
19:27:21 | FromDiscord | <Phil> std/isolate was his response which imo is not really a solution |
19:28:34 | FromDiscord | <Phil> To understand why it isn't a solution, play a bit around with it and see the limitations on what you can isolate and what you can't isolate.↵Note that a very common usecase would be that you instantiate/create a piece of data at one place in your code, e.g. when receiving a user-input, and then want to pass it on elsewhere. |
19:29:02 | FromDiscord | <Phil> (edit) "elsewhere." => "elsewhere (for which you must turn it into an "isolated" object)." |
19:29:20 | FromDiscord | <threefour> In reply to @sys64 "Oh thanks and to": `defined(danger)` |
19:29:22 | FromDiscord | <Phil> If you figure out how to use std/isolate in such a scenario without deep-copying the message you're further along than I am |
19:30:48 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @threefour "`defined(danger)`": Alright thanks! |
19:31:52 | FromDiscord | <threefour> So the problem is managing lifetimes when moving between threads? |
19:32:29 | FromDiscord | <Phil> sent a long message, see https://paste.rs/cWBxN |
19:33:31 | FromDiscord | <Phil> In reply to @threefour "So the problem is": It is one of the main problems and arguably the biggest. |
19:35:21 | FromDiscord | <threefour> Gotcha. I think C has the right approach. It's less safe by default, but more flexible. But that's a matter of opinion I guess. |
19:36:22 | FromDiscord | <Phil> Overall for an actor model you need to figure out:↵- How do I want to run tasks on another thread? (Spawn a new thread for the task? Have a threadpool ready and the task is just one in queue of tasks that the pool chews through?)↵- How do I move the memory ownership of a message entirely from A to B↵- How do I manage sending messages from A to B in a flexible manner and make sure tasks have access to that mechanism? |
19:36:41 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/ELAxR |
19:37:15 | FromDiscord | <Phil> In reply to @threefour "Gotcha. I think C": I'm really not sure it is. Nim really only runs into these problems in multithreading space.↵Like, yeah, this problem is harder because of nim's automatic memory management, but also every other piece of code is easier because of that |
19:37:33 | FromDiscord | <Phil> You have people with python skills capable of picking nim up in a week or two and be semi-proficient, that's crazy |
19:38:16 | FromDiscord | <Phil> The automated memory management facilitates so much and reduces the learn curve and error-risk so much that it really shows its value.↵Threading is just where it sadly does get in the way (currently). |
19:40:29 | FromDiscord | <threefour> Fair. I like Nim's "high level by default, low-level when explicitly required" approach. Extending that dynamic to threading would be nice. |
19:40:36 | FromDiscord | <ieltan> In reply to @sys64 "Oh alright But is": you can create your own `toOpenArray` proc/template and then use that |
19:41:01 | FromDiscord | <ieltan> sent a code paste, see https://paste.rs/1yeNk |
19:41:28 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "are you making a": Yeah↵So the user doesn't have to manipulate pointers directly |
19:42:14 | FromDiscord | <Phil> sent a long message, see https://paste.rs/tdF3m |
19:42:38 | FromDiscord | <Phil> But that assumes you can allow yourself to block until the threadpool churned through its ginormous batch of tasks |
19:42:46 | FromDiscord | <Phil> (edit) "But that assumes you can allow yourself to block ... until" added "the main-thread" |
19:43:40 | FromDiscord | <ieltan> sent a code paste, see https://paste.rs/OqWTu |
19:44:14 | FromDiscord | <zidsal> how would you handle a traditional game server architecture in nim where you have N threads for connections and 1 thread that runs the game loop that also needs to send game state back to the clients? |
19:44:34 | FromDiscord | <Phil> That's the scenario that I'd just give up on. |
19:44:40 | FromDiscord | <Phil> As in, I have no good answer for you |
19:44:46 | FromDiscord | <zidsal> I thought so |
19:44:47 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "data field should be": Oh, thanks for the advice |
19:44:56 | FromDiscord | <Phil> If the game-state is small enough to deep copy I'd go with that |
19:45:13 | FromDiscord | <Phil> If it's large enough that you must move it, I have no strategy that is semi-easily doable |
19:45:35 | FromDiscord | <Phil> Maybe Araq has a better idea there, I certainly don't (note, I am not a multithreading expert by any means) |
19:45:35 | FromDiscord | <zidsal> it should be able to be small enouigh that copying is fine |
19:45:39 | FromDiscord | <zidsal> afterall it needs to go over the wire |
19:45:56 | FromDiscord | <ieltan> In reply to @ieltan "data field should be": this is cause iirc `system.toOpenArray()` only has a `ptr UncheckedArray[T]` overload for raw pointers and not `ptr T` |
19:45:58 | FromDiscord | <Phil> In reply to @zidsal "afterall it needs to": over the wire means what? |
19:46:04 | FromDiscord | <Phil> Like, internet? |
19:46:27 | FromDiscord | <zidsal> ya its a server client model |
19:46:28 | FromDiscord | <Phil> Are we in a scenario with multiple machines? |
19:46:36 | FromDiscord | <Phil> Or is this one machine? |
19:46:43 | FromDiscord | <zidsal> multiple |
19:47:23 | FromDiscord | <Phil> Oh lord, so you're doing rpc calls since its a game I assume or some stuff... yeah I know next to nothing about things happening in gamdev |
19:47:26 | FromDiscord | <Phil> (edit) "gamdev" => "gamedev" |
19:47:46 | FromDiscord | <Phil> Beef is a better sparring partner for you then 😄 |
19:48:07 | FromDiscord | <zidsal> the problem with talking to beef is I instant get hungry |
19:48:28 | FromDiscord | <Phil> I mostly tackled multithreading from the perspective of wanting some level of actor model for GUI applications. Didn't have to be the most performant, just a possibility to move stuff to another thread |
19:49:20 | FromDiscord | <Phil> Nothing implemented yet, mind you.↵Or rather, I'm currently a bit in the mental planning stage where I'm solidifying my mental model and how I want to structure it all |
19:49:34 | FromDiscord | <Phil> Getting the metaphor straight after which I'll be modeling the lib etc. |
19:49:41 | FromDiscord | <Phil> (edit) "after" => "with" |
19:50:26 | FromDiscord | <Phil> I had a first implementation of a first approach but that has so many limitations and so much error-prone code that it's not worth finalizing that particular pursuit I don't think |
19:56:30 | FromDiscord | <Elegantbeef> @Phil I don't use multi threading 😛 |
20:03:18 | FromDiscord | <System64 ~ Flandre Scarlet> You need a Doctoral degree to master multithreading |
20:04:02 | FromDiscord | <Elegantbeef> Nah just need helgrind and valgrind |
20:07:54 | FromDiscord | <Phil> and/or asan tsan with the ability to read stacktraces |
20:08:07 | FromDiscord | <Phil> And a lot of mental fortitude to deal with some next level bs |
20:10:14 | * | krux02_ joined #nim |
20:13:20 | * | krux02 quit (Ping timeout: 268 seconds) |
20:30:32 | FromDiscord | <xkonti> sent a code paste, see https://paste.rs/3jH7f |
20:38:55 | FromDiscord | <ElegantBeef> Bridge dropped a message yay! |
20:39:05 | FromDiscord | <ElegantBeef> To answer your question nope only `method` has dynamic dispatch |
20:39:09 | FromDiscord | <ElegantBeef> What's even the point of that iterator? |
20:39:53 | FromDiscord | <ElegantBeef> If you want to reuse a string buffer just make it `start: int64, str: var string` and use `str.len`'s starting size as the capacity |
20:40:18 | FromDiscord | <mratsim> In reply to @threefour "Gotcha. I think C": C has no approach. Anything you can do with C you can do in Nim. |
20:40:19 | FromDiscord | <ElegantBeef> then you can define a `readStr` with no `var string` and emit the var and iterate over the file in those chunks |
20:40:39 | FromDiscord | <mratsim> Multithreading in C is left as an exercise to the reader |
20:40:58 | FromDiscord | <ElegantBeef> Remember when you shoot yourself in the foot use a nailgun so you cannot move your feet to run away from consqueneces |
20:43:01 | FromDiscord | <Phil> ... But I really, really want to run away from the consequences! |
20:44:54 | FromDiscord | <.lisuwu_> In reply to @elegantbeef "Remember when you shoot": would a shotgun that shoots in opposite direction work |
20:45:13 | FromDiscord | <Elegantbeef> I mean it could work I'm not a gunologist |
20:45:40 | FromDiscord | <.lisuwu_> but beef i thought you knew everyting !! |
20:45:45 | FromDiscord | <.lisuwu_> (edit) "everyting" => "everything" |
20:46:43 | FromDiscord | <xkonti> Ok. I guess I'll have the iterator in the base class call a specific method that can be implemented by the subclasses. |
20:47:24 | FromDiscord | <Elegantbeef> If you don't stop calling them classes I'll bring out my terminology ticket book |
20:47:30 | FromDiscord | <mratsim> In reply to @xkonti "Ok. I guess I'll": but the appeal of such iterator is being inlined, now you add a method indirection? |
20:48:05 | FromDiscord | <Elegantbeef> They want to use dynamic dispatch for all their stuff cause they only want the user to use a `CommonFS` type |
20:48:31 | FromDiscord | <mratsim> https://tenor.com/view/we-dont-do-that-here-black-panther-tchalla-bruce-gif-16558003 |
20:48:57 | FromDiscord | <Elegantbeef> I concur, but alas |
20:49:00 | FromDiscord | <ieltan> Embed fail |
20:49:08 | FromDiscord | <Elegantbeef> Embeds are disabled here |
20:49:18 | FromDiscord | <ieltan> lol |
20:49:20 | FromDiscord | <mratsim> images and gifd are blocked in the channel so a link is the next best thing |
20:51:09 | * | krux02_ quit (Quit: Leaving) |
20:51:15 | FromDiscord | <xkonti> @mratsim what @ElegantBeef said. You write your code using the CommonFs abstraction that defines all the things you can do with a "File system". And then you can pick whatever implementation of CommonFs you want. Your code stays 100% the same no matter if you use real file system, in-memory file system, SFTP, S3 buckets, etc. You could even have a case statement that chooses which impentation to instantiate and the rest of the code stays t |
20:51:49 | FromDiscord | <Elegantbeef> You could do the same with generics and not have any inheritance trees 😄 |
20:51:59 | FromDiscord | <Elegantbeef> But there is no boxing with them, you'd have to manually box |
20:53:34 | FromDiscord | <xkonti> Hmm... I guess with generics I could define `FileSystem[TImplementation]`, with the TImplementation being a `concept`? |
20:54:40 | FromDiscord | <ieltan> If `TImplementation` is a concept then it would be a refinement |
20:55:10 | FromDiscord | <ieltan> `FileSystem[T: TImplementation]` |
20:55:12 | FromDiscord | <xkonti> But then I would end up with `FileSystem[T]`, `File[T]`, `Dir[T]` everywhere. Library usage would become painful. |
20:55:32 | FromDiscord | <Elegantbeef> Hey I dislike dynamic dispatch |
20:55:35 | FromDiscord | <Elegantbeef> Don't look at me 😄 |
20:56:14 | FromDiscord | <xkonti> Hehe I know. My next step will be making EVERYTHING async... And I don't know if one can make the iterator async in Nim... |
20:56:16 | FromDiscord | <Elegantbeef> "Didn't you write a library that enables a nice trait-like dynamic dispatch ?!" We don't talk about that |
20:56:53 | FromDiscord | <Elegantbeef> Iterators cannot be async, but the code they use can |
20:57:23 | FromDiscord | <ieltan> You could just await every yield |
20:57:27 | FromDiscord | <xkonti> In reply to @Elegantbeef "Iterators cannot be async,": I guess I need to go back to C# 😦 |
20:57:47 | FromDiscord | <Elegantbeef> Yea you just await the response |
20:58:58 | FromDiscord | <Elegantbeef> Or you yield a future |
20:58:58 | FromDiscord | <Elegantbeef> Then you do `await` or `waitfor` on the recieving side |
20:59:08 | FromDiscord | <ieltan> Nim has minimal support for dynamic dispatch so yeah if you really really really need it you'll be in a tough spot |
20:59:35 | FromDiscord | <ieltan> And oop I guess |
20:59:44 | FromDiscord | <System64 ~ Flandre Scarlet> Is it possible to convert a pointer to an UncheckedArray? |
21:00:00 | FromDiscord | <solitudesf> yeah, you cast it |
21:00:00 | FromDiscord | <Elegantbeef> I'd say it has support it's just not the most C#/Java like |
21:00:03 | FromDiscord | <ieltan> In reply to @sys64 "Is it possible to": yeah, so long you know the type of the pointer |
21:00:51 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "yeah, so long you": so cast[UncheckedArray[MyType]](myPointer)? |
21:02:54 | FromDiscord | <Elegantbeef> `ptr UncheckedArray[T]` |
21:06:12 | FromDiscord | <ieltan> In reply to @sys64 "so cast[UncheckedArray[MyType]](myPointer)?": What beef said |
21:07:05 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=YVGigWRf |
21:09:15 | FromDiscord | <Elegantbeef> I'd personally just do `span.data.toOpenArray(0, span.length)[idx]` |
21:09:15 | FromDiscord | <Elegantbeef> Removes all of the above |
21:09:16 | FromDiscord | <Elegantbeef> You do not need any of the checks I mean |
21:11:04 | FromDiscord | <ieltan> LGTM I guess |
21:11:39 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "I'd personally just do": Oh, so can't I just use an OpenArray instead my own type? |
21:11:48 | FromDiscord | <Elegantbeef> No |
21:12:02 | FromDiscord | <Elegantbeef> `openArray` can only be used as a parameter |
21:12:07 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
21:12:13 | * | beholders_eye joined #nim |
21:12:13 | FromDiscord | <ieltan> does indexing UncheckedArray using `toOpenarray` even make a difference? |
21:12:20 | FromDiscord | <Elegantbeef> Yes |
21:12:55 | FromDiscord | <Elegantbeef> Cause now it uses `[]` for openArray instead of `Unchecked` |
21:13:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=hVYKzwcm |
21:14:15 | FromDiscord | <ieltan> Ah |
21:14:19 | FromDiscord | <ieltan> Duh |
21:15:28 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=nYLlmwbR |
21:15:54 | FromDiscord | <Elegantbeef> You could or you could juse use open array assignment |
21:16:42 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You could or you": so a = b? |
21:16:43 | FromDiscord | <Elegantbeef> Nevermind there is not one for open array |
21:17:47 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=ZlnBEttH |
21:17:56 | FromDiscord | <Elegantbeef> Well I was thinking `data[0..len] = openArray`1 |
21:18:02 | FromDiscord | <Elegantbeef> But that's not valid |
21:18:33 | FromDiscord | <Elegantbeef> It's only valid for seqs and arrays not openarrays |
21:19:20 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=CIQLnHWG |
21:19:37 | FromDiscord | <Elegantbeef> Copy the procedure header and call it internally |
21:19:44 | FromDiscord | <Elegantbeef> Or use a template for overloaded ones |
21:19:48 | FromDiscord | <aintea> how |
21:20:00 | FromDiscord | <threefour> In reply to @mratsim "Multithreading in C is": That's what I mean. Making it possible to do it from scratch like in C is good. But having higher-level functionality that takes care of the details is also good. Choosing one over the other is bad. |
21:20:03 | FromDiscord | <aintea> wym copy the procedure header |
21:20:26 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "It's only valid for": So what can I do to accept seqs, arrays AND spans? |
21:20:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=PIPyZOWA |
21:20:57 | FromDiscord | <Elegantbeef> Make a overloads for `openArray[T]` and `Span[T]` |
21:22:44 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Make a overloads for": Oh alright, thanks↵Is there also a way to do a memcpy? My auto-completion doens't work well :/ |
21:23:10 | FromDiscord | <ieltan> system.copyMem |
21:23:17 | FromDiscord | <ieltan> I think |
21:23:35 | FromDiscord | <threefour> What's the equivalent of a void pointer in Nim? |
21:23:40 | FromDiscord | <Elegantbeef> Yes it's called `copyMem` |
21:23:40 | FromDiscord | <Elegantbeef> It works just the same as the C version |
21:23:40 | FromDiscord | <Elegantbeef> dest, src, amount |
21:23:41 | FromDiscord | <ieltan> I'm on phone I can't demonstrate how it works lol |
21:23:43 | FromDiscord | <Elegantbeef> `pointer` |
21:25:45 | FromDiscord | <nocturn9x> In reply to @ieltan "you're using minalloc right": yes |
21:25:59 | FromDiscord | <nocturn9x> In reply to @ieltan "so yeah i figured": any sort of shared memory in nim is a lie |
21:26:06 | FromDiscord | <nocturn9x> just use `ptr` |
21:26:11 | FromDiscord | <nocturn9x> less headaches |
21:26:21 | FromDiscord | <nocturn9x> wrap it in some abstractions maybe but yeah that's it |
21:27:02 | FromDiscord | <Elegantbeef> Well `SharedPtr` exists |
21:27:26 | FromDiscord | <Elegantbeef> No point making your own ref counted shared pointer |
21:28:40 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=aqBcICbj |
21:29:06 | FromDiscord | <Elegantbeef> More usage of return for no reason |
21:29:08 | FromDiscord | <Elegantbeef> You hate to see it |
21:30:04 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "You hate to see": Wdym? |
21:30:19 | FromDiscord | <Elegantbeef> Stop using `return` when it's an expression |
21:30:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=CQXuMmfC |
21:31:20 | FromDiscord | <threefour> Do all heap allocations in ORC use a shared heap by default? Or do you need to specifically use a `SharedPtr`? |
21:31:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=wKPraBNF |
21:31:37 | FromDiscord | <System64 ~ Flandre Scarlet> Oh, even better |
21:31:43 | FromDiscord | <ieltan> In reply to @threefour "Do all heap allocations": Arc/Orc is shared heap yeah |
21:31:52 | FromDiscord | <Elegantbeef> Nim uses shared heap by default, but the issue is that the ref counter is not atomic so it attempts to double free |
21:32:30 | FromDiscord | <Elegantbeef> Then to add on top of that Orc is not thread safe so it incorrectly frees cycles |
21:32:39 | FromDiscord | <threefour> Lol |
21:32:45 | FromDiscord | <Elegantbeef> `--mm:atomicArc` does exist which turns all `ref` into equal to `SharedPtr` |
21:33:32 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=gbdGTZQK |
21:34:03 | FromDiscord | <Elegantbeef> Right |
21:35:02 | * | krux02 joined #nim |
21:35:34 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=kVqqeOop |
21:36:46 | FromDiscord | <threefour> I'm not sure how I feel about implicit returns. When my function is a one-liner, I usually omit it. But if there are any early `returns`, I always make the final line have one too. |
21:36:47 | FromDiscord | <ieltan> In reply to @nocturn9x "yes": Aight, ty bro |
21:37:00 | FromDiscord | <nocturn9x> no problem |
21:37:16 | FromDiscord | <nocturn9x> if I can help someone avoid the madness I went through, that's good |
21:37:31 | FromDiscord | <nocturn9x> if anything this motivated me to design the threading model in my language extra carefully |
21:37:38 | * | krux02_ joined #nim |
21:37:57 | FromDiscord | <ieltan> You're making your own language? That's dedication |
21:38:02 | FromDiscord | <nocturn9x> I am |
21:38:06 | FromDiscord | <nocturn9x> have been at it for a while |
21:38:08 | FromDiscord | <nocturn9x> it's also in Nim |
21:38:47 | FromDiscord | <threefour> You must be @Robyn [She/Her]'s alt account |
21:38:51 | FromDiscord | <nocturn9x> currently the project is on pause cuz life gets in the way and I'm also working on a far more entertaining project (the chess engine that caused the threading nonsense) |
21:39:04 | FromDiscord | <nocturn9x> In reply to @threefour "You must be <@524288464422830095>'s": if I were you'd never know that's for sure |
21:39:07 | FromDiscord | <threefour> Jk |
21:39:13 | FromDiscord | <nocturn9x> or are you |
21:39:18 | FromDiscord | <threefour> 👀 |
21:39:39 | FromDiscord | <nocturn9x> anyway considering I've ran several thousand games now I'm positive the issue was mostly what I described |
21:39:48 | FromDiscord | <nocturn9x> which isn't to say I might not face more in the future |
21:39:59 | FromDiscord | <nocturn9x> for my parallel search I'll probably use std/threadpools to avoid this issue |
21:40:05 | * | krux02 quit (Ping timeout: 240 seconds) |
21:40:06 | FromDiscord | <Elegantbeef> I mean issue is less of design and just unimplemented logic 😄↵(@nocturn9x) |
21:40:19 | FromDiscord | <nocturn9x> true, that's fair |
21:40:41 | FromDiscord | <nocturn9x> the fact joinThread doesn't clean up the thread vars is, like |
21:40:47 | FromDiscord | <nocturn9x> such a low hanging fruit |
21:40:51 | FromDiscord | <Elegantbeef> Threadvars do not clear, threads cannot be one shots, the allocator is bugged, .... |
21:41:19 | FromDiscord | <ieltan> Death by a thousand gunshots |
21:41:35 | FromDiscord | <nocturn9x> my projects usually tend to sacrifice performance for correctness |
21:41:37 | FromDiscord | <nocturn9x> always |
21:41:49 | FromDiscord | <nocturn9x> I prefer to do the right thing a bit slower than do the wrong thing really fast |
21:42:09 | FromDiscord | <nocturn9x> and there's always time for optimization later, when you have a solid base to build off of |
21:42:13 | FromDiscord | <threefour> I usually end up doing the wrong thing really slow |
21:42:14 | FromDiscord | <nocturn9x> clearly this was not the case here |
21:42:29 | FromDiscord | <nocturn9x> that's another issue, but you're not alone xD |
21:42:34 | FromDiscord | <nocturn9x> I just fixed an issue in my engine |
21:42:39 | FromDiscord | <nocturn9x> you wanna know the prolem |
21:42:42 | FromDiscord | <nocturn9x> (edit) "prolem" => "problem" |
21:42:50 | FromDiscord | <ieltan> Sounds interesting |
21:42:55 | FromDiscord | <nocturn9x> I was doing `self.search()` when I was supposed to do `-self.search()` |
21:43:06 | FromDiscord | <nocturn9x> a single byte fucked with the entire null move pruning impl. |
21:43:08 | FromDiscord | <nocturn9x> oof |
21:43:24 | FromDiscord | <nocturn9x> the reason being that you're looking for your opponent's score, so you have to flip the sign |
21:43:31 | FromDiscord | <ieltan> Ugh one off mistakes |
21:43:31 | FromDiscord | <nocturn9x> otherwise you get the wrong thing |
21:43:57 | FromDiscord | <nocturn9x> but hey, at least: `Elo difference: 37.6 +/- 28.8, LOS: 99.5 %, DrawRatio: 32.4 %` |
21:44:04 | FromDiscord | <nocturn9x> still not complete, but _very_ promising |
21:44:29 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=THuCLjKE |
21:44:42 | FromDiscord | <Elegantbeef> Yes you can |
21:44:46 | FromDiscord | <Elegantbeef> Just as an export statement |
21:44:50 | FromDiscord | <nocturn9x> yeah |
21:44:55 | FromDiscord | <nocturn9x> `export a.b` |
21:44:55 | FromDiscord | <System64 ~ Flandre Scarlet> export Palette? |
21:44:57 | FromDiscord | <System64 ~ Flandre Scarlet> Oh |
21:44:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=PETwxmRA |
21:45:01 | FromDiscord | <nocturn9x> or that |
21:45:02 | FromDiscord | <nocturn9x> yeah |
21:45:07 | FromDiscord | <System64 ~ Flandre Scarlet> neat! |
21:45:20 | FromDiscord | <nocturn9x> that is one of the features I stole from nim for my compiler |
21:45:24 | FromDiscord | <nocturn9x> among many |
21:45:42 | FromDiscord | <System64 ~ Flandre Scarlet> So this way I can completely obfuscate the Tilengine module behind my own functions |
21:45:56 | FromDiscord | <nocturn9x> isn't abstraction great? |
21:46:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @nocturn9x "isn't abstraction great?": There are some things I want to abstract |
21:48:59 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=NCsmfzIl |
21:49:31 | FromDiscord | <Elegantbeef> I'd name it `init` or `new` depending if it was a value type or reference type |
21:50:29 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "I'd name it `init`": seems new is reserved |
21:50:53 | FromDiscord | <System64 ~ Flandre Scarlet> proc create(_: typedesc Palette, numEntries: int): Palette =↵ createPalette(numEntries)↵↵let myPal = Palette.create(16) |
21:51:08 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/1238246901183152239/image.png?ex=663e96ca&is=663d454a&hm=6fcc09da1388795af0d3bb495919fb3caca48beae6d5c440d7d2dffd9c669cf2& |
21:51:12 | FromDiscord | <Elegantbeef> It's not reserved |
21:51:25 | FromDiscord | <Elegantbeef> New can be overloaded just fine |
21:52:16 | FromDiscord | <System64 ~ Flandre Scarlet> So why do I have this error? |
21:53:03 | FromDiscord | <polylokh_39446> `_: static typedesc = Palette` |
21:53:47 | FromDiscord | <Elegantbeef> No you do not need static |
21:53:56 | FromDiscord | <Elegantbeef> `typedesc[Palette]` should suffice |
21:55:03 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=qivBqfqH |
21:55:14 | FromDiscord | <Elegantbeef> The former is better |
21:55:17 | FromDiscord | <Elegantbeef> As it works with generics |
21:55:23 | FromDiscord | <Elegantbeef> Reusable composable code is good code |
21:55:55 | FromDiscord | <System64 ~ Flandre Scarlet> The former = First? |
21:56:25 | FromDiscord | <Elegantbeef> Yes |
21:56:26 | FromDiscord | <polylokh_39446> Yes. former/latter are first/second for pairs. |
21:56:42 | FromDiscord | <Elegantbeef> first and last |
21:56:59 | FromDiscord | <System64 ~ Flandre Scarlet> oh alright↵thanks for the advice! |
21:57:23 | FromDiscord | <Elegantbeef> Hmph does it work for 2 or more items.... |
21:57:47 | FromDiscord | <polylokh_39446> in this context I don't think so. There are other uses of the words, like "Latter-day Saints" |
21:58:19 | FromDiscord | <polylokh_39446> 1. Later; more recent; coming or happening after something else; -- opposed to former.↵-> 2. Of two things, the one mentioned second.↵3. Recent; modern. |
21:58:59 | FromDiscord | <polylokh_39446> with 2 or more items, meaning 1 should still work, but I bet people will get confused |
21:59:30 | FromDiscord | <Elegantbeef> Clearly it should be formist and lattist |
21:59:49 | FromDiscord | <polylokh_39446> and I think it'd be "a latter", rather than "the latter" |
22:00:20 | FromDiscord | <polylokh_39446> if Lisp had won we could be saying cadr by now |
22:02:41 | FromDiscord | <Robyn [She/Her]> In reply to @threefour "You must be <@524288464422830095>'s": Nope?- |
22:32:33 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=PWucrjGw |
22:49:43 | * | mal`` quit (Quit: Leaving) |
22:51:12 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=YmXQxXYG |
22:53:03 | FromDiscord | <Elegantbeef> Speaking of silly returns |
22:53:17 | FromDiscord | <Elegantbeef> Why would it delete twice? |
22:54:09 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Why would it delete": Values in functions are passed by copy |
22:54:27 | FromDiscord | <Elegantbeef> Not always |
22:54:31 | FromDiscord | <Elegantbeef> Plus the copy is immutable |
22:54:45 | FromDiscord | <System64 ~ Flandre Scarlet> So in my case, it's not by copy? |
22:54:51 | FromDiscord | <Elegantbeef> Values are only passed by copy when they're smaller than sizeof(float) \ 3 |
22:54:54 | FromDiscord | <Elegantbeef> So yes it's by copy |
22:55:20 | FromDiscord | <Elegantbeef> But the copy does not use destructors as that'd cause silly behaviour |
22:55:27 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright↵But why the destructor isn't called at the end of the doSomething()'s scope? |
22:55:35 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright! |
22:55:38 | FromDiscord | <Elegantbeef> It's a bitcopy it does not use `=dup` or `=copy` |
22:56:26 | FromDiscord | <polylokh_39446> parameters are immutable in Nim, so it's free to pass a pointer for large objects and blit smaller objects |
22:56:30 | FromDiscord | <System64 ~ Flandre Scarlet> So with those custom destructors, I can actually make the Tilengine binding safer |
22:57:11 | FromDiscord | <Elegantbeef> Yes you can either disable `=dup` or make it call the appropriate internal procs |
22:57:52 | FromDiscord | <polylokh_39446> you can also compile with --expandArc:module or --expandArc:proc to see the lifetime functions that get injected |
22:58:16 | FromDiscord | <System64 ~ Flandre Scarlet> Wow sounds quite complex |
23:09:40 | * | mal`` joined #nim |
23:13:11 | * | def- quit (Quit: -) |
23:13:24 | * | def- joined #nim |
23:26:43 | * | KhazAkar quit (Ping timeout: 255 seconds) |
23:59:19 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=zbmCzKIr |