00:03:15 | Amun-Ra | ok, something optimizes them away: https://dpaste.com/89BSE2Q4M |
00:11:37 | Amun-Ra | N_LIB_PRIVATE N_CDECL(NCSTRING, __lsan_default_options)(void); |
00:18:05 | Amun-Ra | and N_LIB_PRIVATE is __attribute__((visibility("hidden"))) |
00:18:10 | FromDiscord | <ElegantBeef> Bridge dieded |
00:18:18 | FromDiscord | <ElegantBeef> `dynlib` is for ensuring it does not get DCE'd away |
00:18:20 | Amun-Ra | I wonder why it's N_LIB_PRIVATE |
00:19:01 | Amun-Ra | can I mark exportc function with dynlib? |
00:19:06 | FromDiscord | <ElegantBeef> Yes |
00:19:14 | FromDiscord | <Chronos [She/Her]> That's what you're supposed to do, no? |
00:19:36 | FromDiscord | <Chronos [She/Her]> No use adding dynlib to a proc if the calling convention is still Nim |
00:19:38 | FromDiscord | <ElegantBeef> `exportc, dynlib` pair should disable DCE on a procedure and ensure it compiles in |
00:19:51 | FromDiscord | <ElegantBeef> You can use `dynlib` on a `nimcall` |
00:20:02 | Amun-Ra | well, not strings works, but the whole thing sigsegvs |
00:20:04 | FromDiscord | <ElegantBeef> A symbol does not need to be cdecl to be usable across the ABI |
00:20:05 | Amun-Ra | npw* |
00:20:08 | Amun-Ra | now* |
00:20:10 | FromDiscord | <Chronos [She/Her]> Yeah but using it as a shared library wouldn't be great, no? |
00:20:17 | FromDiscord | <ElegantBeef> `exportc:"...", dynlib` should work |
00:20:30 | FromDiscord | <Chronos [She/Her]> Ah welp |
00:20:51 | Amun-Ra | Segmentation fault |
00:21:38 | FromDiscord | <ElegantBeef> Can also try `extern` but that should not change anything |
00:22:28 | Amun-Ra | both are now marked N_LIB_EXPORT thanks to dynlib |
00:22:49 | FromDiscord | <ElegantBeef> You should also mark it `cdecl` but since you're on linux that's neither here no there đ |
00:23:37 | Amun-Ra | found it |
00:23:46 | Amun-Ra | proc lsan_default_suppressions*(): cstring {.exportc: "__lsan_default_suppressions", dynlib, stackTrace: off.} = |
00:23:59 | Amun-Ra | stack trace was the culprit |
00:26:22 | Amun-Ra | -> https://dpaste.com/AFHUHT774 |
00:28:27 | Amun-Ra | thanks for the dynlib hint |
00:33:34 | Amun-Ra | well, it does run, but suppressions are ignored, lsan is very picky, emit won |
00:42:42 | FromDiscord | <Phil> Beef!â”Any thoughts on system/channel vs threading/channel vs GAsyncQueue? |
00:43:35 | FromDiscord | <bostonboston> "why would you ever need more than one thread" -beef probably |
01:51:04 | FromDiscord | <ElegantBeef> Bridge moment |
01:51:49 | FromDiscord | <ElegantBeef> @Phil I do wonder if you can use `GAsyncQueue` with `move(myRef)` |
02:30:10 | FromDiscord | <bostonboston> is there a mapIt for arrays |
02:31:34 | FromDiscord | <_nenc> i think there is a lib for it |
02:31:55 | FromDiscord | <_nenc> https://github.com/choltreppe/arrayutils |
02:59:47 | * | nmz quit (Remote host closed the connection) |
03:03:03 | * | nmz joined #nim |
03:20:39 | NimEventer | New thread by Nlits: Errors within async are not being raised, see https://forum.nim-lang.org/t/10724 |
03:53:16 | * | cm quit (Quit: Bye.) |
04:02:13 | * | cm joined #nim |
04:08:03 | * | rockcavera joined #nim |
04:09:06 | * | NunavuT joined #nim |
04:15:41 | * | NunavuT quit (Remote host closed the connection) |
04:16:02 | * | NunavuT joined #nim |
05:02:11 | * | NunavuT quit (Remote host closed the connection) |
05:02:30 | * | NunavuT joined #nim |
05:11:31 | * | NunavuT quit (Remote host closed the connection) |
06:02:19 | * | Nunavut_ joined #nim |
06:02:35 | * | Nunavut_ quit (Remote host closed the connection) |
06:02:55 | * | NunavuT joined #nim |
06:34:55 | * | azimut quit (Ping timeout: 240 seconds) |
06:58:56 | * | xaltsc quit (Ping timeout: 252 seconds) |
07:14:51 | * | Jjp137_ joined #nim |
07:15:10 | * | Jjp137 quit (Ping timeout: 245 seconds) |
07:31:41 | * | rockcavera quit (Remote host closed the connection) |
07:59:21 | * | junaid_ joined #nim |
09:05:48 | FromDiscord | <Phil> I think I'm being silly here somewhere |
09:06:11 | FromDiscord | <bostonboston> Not everywhere? |
09:09:14 | FromDiscord | <intellij_gamer> NimNode is the wrong returnâ”Returned untyped |
09:09:23 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/YPbKf |
09:09:27 | FromDiscord | <intellij_gamer> (edit) "returnâ”Returned" => "returnâ”Return" | "returnâ”Returnuntyped ... " added "(or void)" |
09:09:32 | FromDiscord | <intellij_gamer> (edit) removed "(or void)" |
09:09:40 | FromDiscord | <Phil> Argh, when you least expect it, yeah that was it, thanks |
09:10:23 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/h4X6r |
09:11:19 | * | junaid_ quit (Quit: Lost terminal) |
09:29:40 | FromDiscord | <Phil> Can you figure out from which file a NimNode comes from? |
09:30:11 | FromDiscord | <ringabout> in system.nim I suppose |
09:30:20 | FromDiscord | <ringabout> But you can search with `NimNode` |
09:30:52 | FromDiscord | <Phil> Not the type, I mean I have a NimNode that was "registered" with a macro from me and I want to know which file did that |
09:31:27 | FromDiscord | <Phil> Mostly for an error message along the lines of "A proc with that name was already registered, see <file that did that>. Please change the proc name" |
09:32:10 | FromDiscord | <ringabout> I think you can get a lineinfo or something, at least you can use `error` in a macro |
09:32:37 | FromDiscord | <ringabout> https://nim-lang.org/docs/macros.html#error%2Cstring%2CNimNode |
09:32:59 | FromDiscord | <Phil> Yeah the issue is more that in terms of order you have File A calling macro A, which is fine.â”Then File B calls macro A and it throws an error.â”Now the generated code from the macro is in File B, but I want the name of File A |
09:36:56 | FromDiscord | <Phil> In reply to @ringabout "https://nim-lang.org/docs/macros.html#error%2Cstrin": Hmm I think that's problematic because I have the combination of 2 locations that cause the issue, so I'd want to provide 2 NimNodes here |
09:37:06 | FromDiscord | <Phil> Similar to how the redeclaration error message does it |
09:37:06 | FromDiscord | <ringabout> Sounds complex, but I suppose you can store the registered information along with the file info somehow in a compile-time table |
09:38:44 | FromDiscord | <ringabout> In reply to @ringabout "Sounds complex, but I": You stored the registered NimNode in a compileTime table and call `error` on it when the new one is with the same name |
09:39:32 | FromDiscord | <ringabout> Or store lineinfo somewhere => https://nim-lang.org/docs/macros.html#lineInfo%2CNimNode |
09:39:41 | FromDiscord | <Phil> Can I get error to do line breaks without having to do them myself in the string? |
09:40:03 | FromDiscord | <Phil> In reply to @ringabout "You stored the registered": It might be way easier, I have the NimNode in a Cachetable, I can just extract the lineinfo directly from there, just wasn't aware of lineinfo |
09:40:15 | FromDiscord | <ringabout> Yeah |
09:43:12 | FromDiscord | <arathanis> I think std/macros also has a `hint` that functions like `error` but without the blowing things up |
09:43:20 | FromDiscord | <arathanis> `warning` too |
09:44:13 | FromDiscord | <Phil> Aye, still want to do line breaks though đ |
09:44:22 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/NFucQ |
09:44:43 | FromDiscord | <arathanis> like, you want multiple lines for the message? |
09:45:08 | FromDiscord | <Phil> Yes, the triple quote strings sadly carry over all their white spaces that I'd want to nice looking indentation in my source |
09:45:54 | FromDiscord | <arathanis> `strutils.dedent` |
09:46:41 | FromDiscord | <arathanis> https://media.discordapp.net/attachments/371759389889003532/1180807308482183218/image.png?ex=657ec380&is=656c4e80&hm=25f16d36bfc06518d2e5c31b879074b55bb6e2b3b0820d3ca84aeaf109e52730& |
09:48:05 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/yj3gE |
09:48:57 | FromDiscord | <arathanis> that should do it, yeah? |
09:49:46 | FromDiscord | <arathanis> whats the 8 for? |
09:49:56 | FromDiscord | <Phil> number of whitespaces to remove |
09:50:06 | FromDiscord | <arathanis> if you omit it it will remove all common leading whitespace |
09:50:09 | FromDiscord | <arathanis> is that not what you want? |
09:50:24 | FromDiscord | <Phil> If I do that it removes none of the whitespaces đ |
09:50:36 | FromDiscord | <Phil> And 8 is fine, leaves "otherProcLine" with some indentation which is neat |
09:51:30 | FromDiscord | <arathanis> mine removes all the common whitespace when omitted |
09:51:35 | FromDiscord | <arathanis> thats very weird |
09:51:36 | FromDiscord | <arathanis> like this: |
09:51:38 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/1Pkc2 |
09:51:46 | FromDiscord | <arathanis> https://media.discordapp.net/attachments/371759389889003532/1180808585404489738/image.png?ex=657ec4b1&is=656c4fb1&hm=9988553b042a38af0e614ecf9a9dc2f28bc9b46d832b32fa6249363e32dff43e& |
09:51:52 | FromDiscord | <arathanis> https://media.discordapp.net/attachments/371759389889003532/1180808611123953754/image.png?ex=657ec4b7&is=656c4fb7&hm=9ceb4f0dbe363dd365e6874c7c72037cc24aac9aefb156caa278a992b993a2ea& |
09:52:28 | FromDiscord | <arathanis> so it should still leave extra indentation on your otherProcLine section |
09:52:40 | FromDiscord | <arathanis> since its just finding the leading indent all lines have in common and removing it |
09:52:51 | FromDiscord | <arathanis> but if it really does not work w/o the 8 id be curious to find out why |
10:04:46 | FromDiscord | <intellij_gamer> Think cause Phil has the first line be on the opening """ so there is no common leading whitespaceâ”Should work without the 8 if put on a new line (So that it has common whitespace with the other lines) |
10:05:01 | FromDiscord | <arathanis> ahh you are right |
10:05:29 | FromDiscord | <arathanis> good call |
10:06:37 | FromDiscord | <arathanis> !e import std/[strformat, strutils]; echo dedent(&"{' '.repeat(4)}a\n{' '.repeat(5)}b\n{' '.repeat(6)}c\n") |
10:06:50 | FromDiscord | <arathanis> is that not working anymore or did I just forget how to do it |
10:07:24 | FromDiscord | <arathanis> sent a code paste, see https://paste.rs/5Mzr6 |
10:09:34 | FromDiscord | <ringabout> sent a code paste, see https://paste.rs/54QSd |
10:09:42 | FromDiscord | <arathanis> (edit) "https://paste.rs/ySQtM" => "https://paste.rs/boqTz" |
10:10:34 | FromDiscord | <arathanis> In reply to @ringabout "You can also use": i think they explicitly want some newlines so you are just missing some `\n` in your exxample |
10:10:37 | FromDiscord | <arathanis> (edit) "exxample" => "example" |
10:14:05 | FromDiscord | <ringabout> Nice catch, I forgot to add `\n` for line breaks |
10:14:20 | FromDiscord | <Phil> don't the \n get printed as \n by error? They did whenever I tried |
10:15:25 | FromDiscord | <ringabout> Well, uses `\\n` or &"\n" I believe |
10:18:55 | FromDiscord | <Phil> \\n does not work for sure, why would `&"\n"` (concatenating a "\n" string) be any different than just having \n inside the string itself? |
10:20:35 | FromDiscord | <ringabout> What do you mean it didn't work? I remember similar cases worked for me |
10:21:42 | FromDiscord | <Phil> `{.error: "Potato\\nPotato".}`â”`Error: Potato\nPotato` |
10:22:10 | FromDiscord | <Phil> What the.... |
10:22:57 | FromDiscord | <Phil> Oh damn it, it's the fact I'm in a fmt string |
10:23:26 | FromDiscord | <ringabout> Does't `{.error: "Potato\nPotato".}` work too |
10:23:29 | FromDiscord | <ringabout> (edit) "Does't" => "Doesn't" |
10:24:31 | FromDiscord | <ringabout> sent a code paste, see https://paste.rs/WFGgu |
10:24:37 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Nc0Pq |
10:24:51 | FromDiscord | <Phil> It does, but `{.error: """Potato\nPotato""".}` doesn't |
10:25:03 | FromDiscord | <Phil> And that's where I got caught up |
10:25:25 | FromDiscord | <Phil> Because while prototyping I didn't jump back from triple quote to single quote |
10:27:09 | FromDiscord | <that_dude.> In reply to @bostonboston "is there a mapIt": A bit roundabout, but you could use toSeq on arrays and then use everything else from sequtils |
10:27:23 | FromDiscord | <ringabout> Well, there is a workaround |
10:29:24 | FromDiscord | <ringabout> sent a code paste, see https://paste.rs/QYIVB |
10:33:57 | NimEventer | New thread by Charles: Re.findBounds doesn't return all matches, see https://forum.nim-lang.org/t/10725 |
11:13:05 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/cABk5 |
11:16:11 | NimEventer | New thread by AntonioFS: Operators., see https://forum.nim-lang.org/t/10726 |
12:32:50 | FromDiscord | <intellij_gamer> Could maybe have like a global variable `registered` that you set to true when `generateRoutingProc()` is called. Then have `clientRoute` error if that's true. So you get any errors if trying to register after everything is generated |
12:33:43 | FromDiscord | <intellij_gamer> Probably need to make the global be a macrocache thingy so that your code doesn't break with IC |
12:47:58 | FromDiscord | <pr0c_mm3r> is learning nim after learning python a good ideea |
12:49:38 | FromDiscord | <classid> hey guys, is nim a good language to learn. I do know some python |
12:49:46 | FromDiscord | <classid> Or should I know C already? |
12:55:34 | FromDiscord | <inventormatt> C is not necessary to learn nim and coming from python can be beneficial but you also need to learn how to utilize nim paradigms versus typical python paradigms |
13:03:03 | FromDiscord | <Phil> Given I've been programming in nim for 2 years by now and I'm just now even cursory dealing with C, you can get by just fine without |
13:03:38 | FromDiscord | <Phil> It starts becoming necessary when you get more into the weeds of things like writing bindings to GTK or the like, but that's something you wouldn't do in python either, you'd use a lib. |
13:03:49 | FromDiscord | <Phil> (edit) "lib." => "lib that does that for you." |
13:08:40 | FromDiscord | <rakgew> @classid \: I would second Phil. I am also coming from python and enjoyed learning nim right away. in contact with C I only got when dealing with not yet wrapped C-libraries. |
13:28:35 | FromDiscord | <piqueiras> oh wait nim 2 is already out of beta and everything |
13:30:19 | FromDiscord | <piqueiras> just came back to it for advent of code lmao |
13:47:37 | FromDiscord | <griffith1deadly> hi, i'm using ModernNet (a library) for reading data from a byte seq, but for some reason I'm getting incorrect behaviour on Windows, but correct behaviour on Linux? The code for the library is here: https://github.com/Nimberite-Development/ModernNet/blob/master/src/modernnet/buffer.nim#L112-L116â”â”example: my nickname by client is "griffith1deady", but on windows i get "griffith1deadyd", and on linux i get "griffith1deady" |
13:49:16 | FromDiscord | <Chronos [She/Her]> It's a very odd bug :p |
13:50:15 | FromDiscord | <griffith1deadly> (edit) "hi, i'm using ModernNet (a library) for reading data from" => "sent" | "byte seq, but for some reason I'm getting incorrect behaviour on Windows, but correct behaviour on Linux? The code for the library is here: https://github.com/Nimberite-Development/ModernNet/blob/master/src/modernnet/buffer.nim#L112-L116â”â”example: my nickname by client is "griffith1deady", but on windows i get "griffith1deadyd", and on linux i get |
13:54:12 | FromDiscord | <srabb> is the crown the nim mascot |
13:54:15 | FromDiscord | <srabb> or just the logo |
13:54:26 | FromDiscord | <srabb> or both |
13:54:30 | FromDiscord | <srabb> or neither |
14:00:17 | NimEventer | New thread by LilKeet: Nimsuggest connection over sockets refused, see https://forum.nim-lang.org/t/10727 |
14:02:23 | * | azimut joined #nim |
14:07:10 | FromDiscord | <Phil> My brain hurts over this a bit, but if you have a client and a server and you have a type "ClientMessage".â”What in your mind is that type for? |
14:07:26 | FromDiscord | <Phil> Like what's your interpretation?â”This is mostly about naming a variable |
14:11:15 | FromDiscord | <odexine> In reply to @isofruit "My brain hurts over": use "client reply" or "client response" or "client request" or w/e else |
14:13:56 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "hi, i'm using ModernNet": This is truly baffling honestly- |
14:18:37 | FromDiscord | <Phil> And then I have a routing proc on the server for messages going server <= clientâ”And a routing proc on the client for messages going server => clientâ”â”And all of that naming has confused me so bad I just found at least 5 places where I mixed them up |
14:19:21 | FromDiscord | <Phil> sent a long message, see https://paste.rs/W4NNp |
14:19:33 | FromDiscord | <odexine> if you want, even though it really isnt one, you could call them broadcasts |
14:19:45 | FromDiscord | <odexine> since theyre non-request response |
14:20:10 | FromDiscord | <odexine> or take naming from pubsub too |
14:20:11 | FromDiscord | <odexine> idk |
14:21:01 | FromDiscord | <Phil> It's not that I don't have names for both parties in one message.â”â”It's that I have both parties and both parties take both roles (server/client, publisher/subscriber) to each other |
14:21:41 | FromDiscord | <Phil> (edit) "https://paste.rs/hsQT3" => "https://paste.rs/wb6fX" |
14:21:47 | FromDiscord | <Phil> And that naming gets very easy to mix up. So you need a name that distinguishes messages going A => B from equivalent messages going A <= B. |
14:22:13 | FromDiscord | <Phil> I mean it works now so I have my solution, but I'd love a better naming scheme |
14:23:15 | FromDiscord | <Phil> (edit) "https://paste.rs/udhez" => "https://paste.rs/69scm" |
14:23:41 | FromDiscord | <odexine> i mean |
14:23:48 | FromDiscord | <odexine> serverbroadcast clientbroadcast |
14:23:52 | FromDiscord | <odexine> serverpublish clientpublish |
14:23:58 | FromDiscord | <odexine> serverevent clientevent |
14:26:16 | FromDiscord | <Phil> Wait, still need different names for the things that get published.â”So still ServerMessage and ClientMessage, just that server publishes a ServerMessage instead of server sending a ServerMessage |
14:27:21 | FromDiscord | <Phil> sent a long message, see https://paste.rs/dkz93 |
14:33:53 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "hi, i'm using ModernNet": Should this be reported as a Nim bug then? Since, I see no reason why this should be happening |
14:34:06 | FromDiscord | <odexine> In reply to @isofruit "Wait, still need different": Then use the event one |
14:36:06 | FromDiscord | <Phil> I mean same thing. Is a serverEvent something that occurs on the server because it was pinged? Or is it omething that the server sends to the client to trigger something there?â”Seems similarly ambiguous as message to me right now, though that might be fatigue speaking |
14:47:39 | FromDiscord | <odexine> I donât think you will ever find a terminology that would satisfy your criteria without literally putting âsentâ in the type name |
14:47:43 | FromDiscord | <odexine> Server sent message |
14:48:57 | FromDiscord | <odexine> A server event to me is a message informing clients that an event has occurred for the server, in the context of messages |
14:49:41 | FromDiscord | <odexine> In general, I believe most people interpret subjects in type names as the sender and not the recipient |
14:49:59 | FromDiscord | <odexine> I should sleep I have not slept in 31 hours you go ask beef or something |
15:23:37 | FromDiscord | <Phil> ... can I tell the "noSideEffect" pragma to shut up same as gcSafe by casting? |
15:23:56 | FromDiscord | <Phil> Because I kinda want to be able to log the output of another thread but that is definitely not "noSideEffect", which a proc for `createThread` demands |
15:24:06 | FromDiscord | <Phil> (edit) "output of" => "what happens on" |
15:28:28 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Q0mRB |
15:29:15 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/68gLR |
15:33:50 | FromDiscord | <Phil> Okay the problem seems to be the logger type, but why can't I have a seq of loggers, they're all the same datatype? Wth |
15:35:43 | * | azimut quit (Ping timeout: 240 seconds) |
15:45:13 | FromDiscord | <Phil> Argh, the fact I am logging at all is the problem, not the logger |
15:47:24 | * | krux02 joined #nim |
16:07:11 | FromDiscord | <Phil> Hmm when I'm inside of a proc and want to break out of a while-loop that is outside the proc, what are my options? |
16:08:00 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Hmm when I'm inside": Return value :p |
16:08:13 | FromDiscord | <Chronos [She/Her]> `if breakTheLoopSomehowFromInside(): break` |
16:08:21 | FromDiscord | <Chronos [She/Her]> Just return a boolean and you're good |
16:09:58 | FromDiscord | <Phil> (edit) "Hmm when I'm inside of" => "sent" | "proc and want to break out of a while-loop that is outside the proc, what are my options?" => "code paste, see https://paste.rs/ua5n3" |
16:10:14 | FromDiscord | <Phil> Hmm I'm not sure I'm a massive fan of that, simply because the procs I'm calling are user-defined, aka I am the one providing the while-loop, the user the one providing the proc.â”If I base this on the return type of the proc, they can break the loop in every one of their procs, rather then when one specific proc gets called |
16:11:42 | FromDiscord | <Phil> I guess throwing a "kill"-exception would be another way but that feels also unclearn |
16:11:44 | FromDiscord | <Phil> (edit) "unclearn" => "unclean" |
16:13:10 | FromDiscord | <Phil> Wait, how am I like halfway to writing my own HTTP server when I just wanted to write a "Thread" server |
16:13:10 | FromDiscord | <Phil> the fuck |
16:30:01 | * | jmdaemon quit (Ping timeout: 255 seconds) |
16:30:52 | * | azimut joined #nim |
16:44:55 | FromDiscord | <rakgew> any aoc in nim this year? |
16:46:35 | FromDiscord | <Chronos [She/Her]> #aoc :p |
16:48:43 | * | rockcavera joined #nim |
16:50:50 | FromDiscord | <rakgew> is that a link or a reference to some platform?â”I found bostonbyboston twitch but none on yewtu.be - so I was wondering if they went somewhere else? |
16:53:21 | FromDiscord | <griffith1deadly> it reference to nim discord channel |
16:55:41 | FromDiscord | <rakgew> ah ok. @griffith1deadly\: thank you for the explanation.â”I am not using discord, but thanks for the link @Chronos [She/Her] |
17:00:42 | * | disso-peach joined #nim |
17:04:03 | NimEventer | New thread by mantielero: FMU - C interop, see https://forum.nim-lang.org/t/10728 |
17:13:42 | FromDiscord | <spotlightkid> rakgew\: you can also join via Matrix |
17:13:47 | FromDiscord | <Chronos [She/Her]> In reply to @rakgew "ah ok. <@620135501201932300>\: thank": Ah sorry didn't realise you were on Matrix |
17:15:44 | FromDiscord | <spotlightkid> https://git.0x20.eu/chris/adventofcode-2023â”My solutions so far. I'm not very experienced with Nim but i have been programmng Python for \>= 20 years. Probably shows in my Nim code đ |
17:17:51 | FromDiscord | <spotlightkid> Argh, meant to post that in the AoC channel. Sorry. |
17:20:00 | FromDiscord | <rakgew> I did not realize the link on my end is actually a matrix link. |
17:39:12 | FromDiscord | <Phil> Just to be on the safe side:â”It is perfectly valid to assume that communication between threads is safe, right?â”I don't need to implement some kind of security protocol or the like? |
17:40:00 | FromDiscord | <Phil> (edit) "like?" => "like to prevent interaction with other (potentially malicious) processes/threads?" |
17:41:04 | FromDiscord | <Chronos [She/Her]> How would I copy a seq in Nim? This is my code and wondering how I'd make a copy of this to ensure safety `b.buf[b.pos..<(b.pos+length)]` |
17:41:21 | FromDiscord | <Phil> Have you considered that seqs are value-types in terms of semantics? |
17:44:23 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/TFNrD |
17:44:58 | FromDiscord | <Phil> Yep, always the case for seqs |
17:45:01 | FromDiscord | <Phil> Same for string |
17:45:06 | FromDiscord | <Chronos [She/Her]> Would `result = cast[string](b.buf[b.pos..<(b.pos+length)])` this be acceptable then? :p |
17:45:19 | FromDiscord | <Phil> Which IIRC is why Araq is currently doing a new string thing |
17:45:27 | FromDiscord | <Chronos [She/Her]> Fair |
17:45:54 | FromDiscord | <Phil> I don't think it is, because you're not reassigning the seq itself, you're casting it first |
17:45:57 | FromDiscord | <Phil> That may screw you |
17:46:00 | FromDiscord | <Chronos [She/Her]> Ah |
17:46:56 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://paste.rs/PNPnT |
17:50:50 | FromDiscord | <saint.___.> why is it initTable but newSeq |
17:51:19 | FromDiscord | <saint.___.> shouldn't it be initSeq |
17:54:26 | FromDiscord | <Phil> IIRC new/init are based on where the memory is allocated.â”new = heap, init = stackâ”The semantics of the type are a different discussion. |
17:57:46 | FromDiscord | <saint.___.> oh gotcha |
17:57:49 | FromDiscord | <saint.___.> Makes sense |
17:58:19 | FromDiscord | <treeform> I think it should be initSeq but for historical reasons itâs newSeq because it got the name before the convention |
17:58:47 | FromDiscord | <saint.___.> oh so newSeq puts it on the stack? |
17:58:59 | FromDiscord | <saint.___.> that's kinda confusing if true |
17:59:16 | FromDiscord | <saint.___.> There should be an alias at least then |
17:59:23 | FromDiscord | <Phil> Nope, seq is always on the stack. Always always |
17:59:34 | FromDiscord | <treeform> https://forum.nim-lang.org/t/9021#58827 |
17:59:44 | FromDiscord | <treeform> Araq says so? |
18:00:02 | FromDiscord | <Phil> It's more that treeform is suggesting naming the proc after the semantics, not the allocation |
18:00:36 | FromDiscord | <Phil> And apparently Araq does as well, so I stand corrected regarding my statement that new/init are named based on allocation |
18:01:46 | FromDiscord | <saint.___.> Interesting thread |
18:02:09 | * | xet7 quit (Remote host closed the connection) |
18:03:55 | FromDiscord | <saint.___.> I guess every language is bound to have some quirls |
18:03:57 | FromDiscord | <saint.___.> (edit) "quirls" => "quirks" |
18:04:10 | FromDiscord | <saint.___.> I don't see the big deal in just aliasing initSeq to newSeq |
18:16:14 | FromDiscord | <System64 ~ Flandre Scarlet> Is there a fixed point number library? |
18:16:22 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) |
18:16:24 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "library?" => "library please?" |
18:19:25 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/RN194 |
18:49:44 | FromDiscord | <Phil> Okay I kinda didn't expect when I wrote that post yesterday that I'd have half of a thread server done in a day |
18:50:02 | FromDiscord | <Phil> (edit) "wrote that post" => "learned" | "learnedyesterday ... that" added "about client-server architecture between threads" |
18:59:14 | FromDiscord | <treeform> In reply to @sys64 "hi! Is there a": I stared on one, but never finished |
19:15:41 | * | emery joined #nim |
19:16:04 | * | ehmry quit (Read error: Connection reset by peer) |
19:26:07 | * | PMunch joined #nim |
19:35:42 | PMunch | AoC stream day 3 is live! https://www.twitch.tv/pmunche https://www.youtube.com/watch?v=BdVnw0oWKy0 |
19:48:51 | * | targz77 joined #nim |
20:12:42 | * | redj quit (Ping timeout: 252 seconds) |
20:47:36 | * | krux02 quit (Remote host closed the connection) |
21:11:07 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "I stared on one,": Oh alrightâ”Imo an Fixed Point Number library would be pretty useful, sometimes you want to avoid floats |
21:15:53 | * | PMunch quit (Remote host closed the connection) |
21:19:48 | FromDiscord | <inventormatt> There is this one https://gitlab.com/lbartoletti/fpn it's a few years old but it's likely to still work |
21:38:54 | * | NunavuT quit (Killed (NickServ (GHOST command used by Nunavut_))) |
21:38:59 | * | NunavuT joined #nim |
21:48:33 | * | NunavuT quit (Read error: Connection reset by peer) |
21:53:34 | FromDiscord | <nervecenter> In reply to @chronos.vitaqua "Would `result = cast[string](b.buf[b.pos..<(b.pos+l": Question, when would you need to do something like this? I've got a 30k line commercial CLI application I made that does lots of analysis and math on big arrays and I've never had to do a deep copy. Most of what I need to do can be handled with `map` and `filter`, or another custom function that returns a new array. |
21:55:58 | * | NunavuT joined #nim |
21:56:07 | FromDiscord | <Chronos [She/Her]> In reply to @nervecenter "Question, when would you": Minecraft networking aha, my library reads bytes from a buffer, and to read Minecraft strings, it's a string prefixed with a number |
21:58:24 | FromDiscord | <nervecenter> Yeugh, are you doing JVM interop? |
22:06:52 | NimEventer | New thread by mantielero: Object variant - returning different types, see https://forum.nim-lang.org/t/10729 |
22:11:53 | FromDiscord | <Chronos [She/Her]> In reply to @nervecenter "Yeugh, are you doing": Nope, reimplementation of the protocol aha |
22:12:25 | FromDiscord | <Chronos [She/Her]> Can be found at https://github.com/Nimberite-Development/ModernNet |
22:13:10 | FromDiscord | <Schelz> sent a code paste, see https://paste.rs/zlOBB |
22:23:03 | * | NunavuT quit (Quit: i3) |
22:45:50 | FromDiscord | <treeform> In reply to @sys64 "Oh alright Imo an": Instead of using fix point I used the determinism float point flags when compiling, and that was it. |
22:45:59 | FromDiscord | <bostonboston> In reply to @Schelz "Hi! How can i": `proc clear(number: uint32, pPos: static position, flags: uint32): int32 =` i think |
22:47:05 | FromDiscord | <bostonboston> if you just want immutability omitting `var` from your parameters achieves that |
22:51:41 | * | tiorock joined #nim |
22:51:41 | * | tiorock quit (Changing host) |
22:51:41 | * | tiorock joined #nim |
22:51:41 | * | rockcavera quit (Killed (iridium.libera.chat (Nickname regained by services))) |
22:51:41 | * | tiorock is now known as rockcavera |
22:59:19 | FromDiscord | <Elegantbeef> No that's C const not nim const |
23:06:29 | * | LuxuryMode joined #nim |
23:07:18 | FromDiscord | <Elegantbeef> Stack inheritance sequence is a no no |
23:07:44 | FromDiscord | <Phil> Stack discrimination1 |
23:07:46 | FromDiscord | <Phil> (edit) "discrimination1" => "discrimination!" |
23:08:18 | FromDiscord | <Elegantbeef> Well it down casts to `NumVal` which is `sizeof(8)` |
23:08:32 | FromDiscord | <Elegantbeef> This is a bug that it allows `@[x, y]` |
23:08:43 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/1149f |
23:09:03 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/KyH5u |
23:09:51 | FromDiscord | <Elegantbeef> Since all the types are the same type |
23:10:05 | FromDiscord | <Elegantbeef> But this should likely still error |
23:10:39 | FromDiscord | <Phil> Unrelated sidenote (as I played around with this for the forum thread):â”How do we get around "extracting values" from object variants?â”I feel like I had this problem in the beginning as well, but somehow it just... stopped being one because I started using different patterns |
23:10:55 | FromDiscord | <Chronos [She/Her]> Is there a special 'type' for a parameter that's supposed to be an unused identifier? Like `definePacket(TypeName)`? |
23:10:59 | FromDiscord | <Phil> I just can't consciously remember what I changed in my code-structure that made "extracting values from object variants" a non-issue |
23:11:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/dDVwv |
23:11:54 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "Is there a special": I could use `untyped` but what if someone decides to do something like `definePacket(wah luigi)`? |
23:13:32 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "I could use `untyped`": you need to write macro |
23:14:09 | FromDiscord | <Elegantbeef> You use a case statement to delimit branchesâ”(@Phil) |
23:14:20 | FromDiscord | <Elegantbeef> It's required due to the fact you're branching flow control and typing |
23:14:42 | FromDiscord | <Phil> Yeah but having to do so often becomes annoying fast. I remember being annoyed by that in the beginning but nowadays it just... doesn't come up |
23:15:16 | FromDiscord | <Phil> Like I had to deal with channels only supporting one type.â”Well just generate an object variant and methods for each type you want to put in the object variant so that it's transparent for you, boom problem solved. |
23:16:06 | FromDiscord | <Phil> (edit) "methods" => "procs" | "procsfor each type you want to put in the object variant ... so" added "(to transform type => variant and send through the channel, as well as one for routing each variant to a specific "handler-proc" on the other thread)" |
23:16:21 | FromDiscord | <Phil> (edit) "type.â”Well" => "type per instance.â”Well" |
23:38:55 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @treeform "Instead of using fix": What is that? |
23:53:19 | FromDiscord | <System64 ~ Flandre Scarlet> Alsoâ”Does it requires an FPU? |
23:54:20 | FromDiscord | <treeform> All cpus from like 1988 and after have an FPU |
23:54:42 | FromDiscord | <treeform> (edit) "All ... cpus" added "desktop" |
23:58:25 | FromDiscord | <treeform> Flags like â`-fno-fast-math -ffloat-store -fexcess-precision=standardâ help gcc generate non optimized but predictable float point math |
23:59:13 | FromDiscord | <treeform> They make float point operations slower, but still way faster then fixed point. |