00:04:19 | FromDiscord | <Yepoleb> I get paid in exposure, not money |
00:04:38 | FromDiscord | <Elegantbeef> No one ever pays when I expose to them |
00:04:44 | FromDiscord | <Elegantbeef> Oddly i get a fine |
00:04:54 | FromDiscord | <Yepoleb> Maybe we can arrange something |
00:05:27 | FromDiscord | <Yepoleb> Are you not unattractive? |
00:05:42 | FromDiscord | <Elegantbeef> Lol |
00:11:10 | FromDiscord | <morgan> is there a way to have an array in a variant object have a different length but same name for different kinds? |
00:12:18 | FromDiscord | <Elegantbeef> Nope |
00:12:22 | FromDiscord | <morgan> darn |
00:12:38 | FromDiscord | <morgan> might just make it a seq |
00:12:44 | FromDiscord | <morgan> and not have a fixed length |
00:12:56 | FromDiscord | <Elegantbeef> I'd suggest just having the array of the largest size then implement `[]` that checks the length |
00:13:01 | FromDiscord | <morgan> well, not have the length enforced by the compiler |
00:13:07 | FromDiscord | <Elegantbeef> The largest size is going to be allocated likely anyway |
00:13:16 | FromDiscord | <morgan> oh yea good point |
00:13:24 | FromDiscord | <Elegantbeef> I'm curious can you share the typedef? |
00:13:51 | FromDiscord | <morgan> sent a code paste, see https://paste.rs/E6L |
00:14:08 | FromDiscord | <Elegantbeef> Oh lord jeebus |
00:14:25 | FromDiscord | <morgan> yea the sheer number is why i don't wanna have another case of lol |
00:14:34 | FromDiscord | <morgan> i have a proc for the length already |
00:14:52 | FromDiscord | <morgan> so i can just use that for the length instead of using len anywhere |
00:15:41 | FromDiscord | <morgan> the naming is basically info is something that is fixed and connect is one or more connections, which would be a number that says what thing it's connected to |
00:16:03 | FromDiscord | <morgan> its for a genetic algorithm to make circuits i can't figure out |
00:16:57 | FromDiscord | <morgan> oh and the var ones are numbers that can be tweaked by the selection and mutation processes to refine what each does |
00:17:02 | FromDiscord | <Elegantbeef> I'd argue some of the branches do not make much sense 😄 |
00:17:40 | FromDiscord | <morgan> i could remove the two spst switches |
00:18:18 | FromDiscord | <Elegantbeef> `res, cap, capp, inductor` are all the same branch |
00:18:21 | FromDiscord | <morgan> and maybe make power inputs a special case of signal inputs |
00:18:30 | FromDiscord | <Elegantbeef> Those could be merged together and you could write accessors or just access those names |
00:18:49 | FromDiscord | <morgan> so i think that will be necessary to have split apart for other stuff |
00:18:57 | FromDiscord | <morgan> i can always remove them later on |
00:19:15 | FromDiscord | <Elegantbeef> Yea i was just giving some insights to possibly make it less tall |
00:19:43 | FromDiscord | <Elegantbeef> It barely fits on my portrait monitor! 😛 |
00:20:08 | FromDiscord | <morgan> same here |
00:20:17 | FromDiscord | <morgan> it doesn't fit in vscode |
00:20:40 | FromDiscord | <morgan> but removing all the separate connections variables will really cut the length down |
00:32:31 | NimEventer | New Nimble package! noptics - Linear algebra, classical and quantum optics simulation package, see https://gitlab.com/OFThomas/noptics |
00:34:36 | FromDiscord | <Yepoleb> another one \:) |
00:41:43 | FromDiscord | <morgan> aaaa just spend like 10 minutes confused and eventually figured out a function i was calling to get the slice end (to index and array and add to a seq) had the wrong input |
00:41:57 | FromDiscord | <morgan> :pain: |
00:48:51 | FromDiscord | <Gumbercules> welcome to programming |
00:49:46 | FromDiscord | <Gumbercules> I once spent almost a month chasing down a bug that resulted from me multiplying by `1.0` instead of `-1.0` |
00:50:16 | FromDiscord | <Gumbercules> (edit) "a" => "an entire" |
00:50:29 | FromDiscord | <Gumbercules> I'm sure people dwarf me on that too |
00:50:40 | * | ltriant quit (Ping timeout: 268 seconds) |
01:02:02 | * | Zevv quit (Ping timeout: 252 seconds) |
01:07:59 | NimEventer | New thread by alexeypetrushin: Do you miss these compact syntaxes?, see https://forum.nim-lang.org/t/10018 |
02:11:35 | FromDiscord | <Elegantbeef> @Gumbercules\: https://github.com/beef331/constructor/blob/master/tests/tstructinits.nim#L21 ehhh |
02:11:55 | * | rockcavera quit (Read error: Connection reset by peer) |
02:12:19 | FromDiscord | <Gumbercules> Nice - can it handle multidimensional arrays? |
02:13:08 | * | rockcavera joined #nim |
02:13:08 | * | rockcavera quit (Changing host) |
02:13:08 | * | rockcavera joined #nim |
02:16:13 | FromDiscord | <ElegantBeef> God damn this bridge really likes to die |
02:16:28 | FromDiscord | <ElegantBeef> Nah it doesnt presently, need a to think about that |
02:20:31 | FromDiscord | <ElegantBeef> It does now |
02:22:12 | FromDiscord | <!&luke> what do i do with this code? |
02:22:29 | FromDiscord | <ElegantBeef> With what code? |
02:22:40 | FromDiscord | <!&luke> discord replies broke |
02:23:06 | FromDiscord | <!&luke> sent a code paste, see https://play.nim-lang.org/#ix=2MXN |
02:23:14 | FromDiscord | <ElegantBeef> Gumber you use C style declarations more than I have ever is there anything else they do over there? |
02:24:07 | FromDiscord | <Gumbercules> Mmmm probably. I'll keep my eyes peeled for any new ones I run into and compile a list for you |
02:24:15 | FromDiscord | <Gumbercules> newer C specifications introduced all sorts of fun init shortcuts |
02:24:29 | FromDiscord | <ElegantBeef> Sounds Fun |
02:24:59 | FromDiscord | <ElegantBeef> If it's not evident doing expressions stops positional from working |
02:25:13 | FromDiscord | <ElegantBeef> So like `MyArr.init(myArr[0] = 300, 1)` is invalid |
02:25:28 | FromDiscord | <Gumbercules> yeah I figured as much |
02:25:52 | FromDiscord | <Gumbercules> still better than nothing |
02:25:58 | FromDiscord | <Gumbercules> or the alternative |
02:27:06 | FromDiscord | <Iliketwertles> why can this work fine when called in a pipe but doesnt print file contents till after you hit enter? |
02:27:24 | FromDiscord | <Iliketwertles> https://media.discordapp.net/attachments/371759389889003532/1086475913438433421/message.txt |
02:30:51 | FromDiscord | <Iliketwertles> prob something silly im missing |
02:31:01 | FromDiscord | <Yardanico> what's the supposed usage of this? |
02:31:19 | FromDiscord | <Yardanico> like how do I call it to test the stdin, just with no arguments or some other way? |
02:32:02 | FromDiscord | <Iliketwertles> just like the `cat` command |
02:32:09 | FromDiscord | <Iliketwertles> so a file path after it as a arg |
02:36:43 | * | rockcavera quit (Remote host closed the connection) |
02:38:54 | FromDiscord | <Yardanico> well I think it's because you're trying to always read stdin |
02:39:16 | FromDiscord | <Yardanico> also the code is structured kinda weirdly, is there a reason you need to have CLI argument parsing inside of the loop itself? |
02:39:30 | FromDiscord | <Iliketwertles> not really |
02:39:43 | FromDiscord | <Iliketwertles> try taking out the while loop then? |
02:39:47 | FromDiscord | <Iliketwertles> thats kinda what i was thinking |
02:39:56 | FromDiscord | <Iliketwertles> that or how its reading stdin |
02:40:29 | * | rockcavera joined #nim |
02:42:21 | FromDiscord | <Yardanico> well how about this for a start |
02:42:27 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2Nr6 |
02:42:42 | FromDiscord | <Yardanico> also it's easy to refactor away all the try/except, you can instead check if the file exists, it'll look nicer then |
02:43:09 | FromDiscord | <Elegantbeef> But but what about the race conditions! 😛 |
02:43:37 | FromDiscord | <Yardanico> also judging your code you should check for paramCount == 3 for the color branch, not just 1 |
02:45:01 | FromDiscord | <Iliketwertles> it broke codiums terminal 💀 |
02:45:21 | FromDiscord | <Iliketwertles> fonts a little messed up https://media.discordapp.net/attachments/371759389889003532/1086480431895035934/screenshot_2023-03-17-224505.png |
02:45:47 | FromDiscord | <Elegantbeef> If it survives a `reset` get the flamethrower |
02:45:55 | FromDiscord | <Iliketwertles> also get a really crypted long output when i just put a string in like `test` |
02:46:07 | FromDiscord | <Iliketwertles> ill try to show |
02:46:52 | FromDiscord | <Iliketwertles> but its fine in a normal terminal |
02:46:59 | FromDiscord | <Iliketwertles> nvm then ig its codiums fault |
02:47:54 | FromDiscord | <Iliketwertles> In reply to @Yardanico "also it's easy to": i agree the structure of it before wasnt the best |
02:47:57 | FromDiscord | <Yardanico> i'm gonna move some code around in your case |
03:01:27 | FromDiscord | <Yardanico> how about something like this? I haven't tested it extensively, but still |
03:01:48 | FromDiscord | <Yardanico> @Iliketwertles https://play.nim-lang.org/#ix=2Ry7 |
03:03:16 | FromDiscord | <Yardanico> ah right there's parseEnum instead of doing it with an option, smh |
03:03:40 | FromDiscord | <Yardanico> hm, but it will require changing some logic or outputting with the default color |
03:04:20 | FromDiscord | <Yardanico> also yeah my usage of fileExists is probably questionable because I don't know how it will behave with huge file sizes, ideally the code should be changed to not read everything like your original did |
03:04:30 | FromDiscord | <Yardanico> i mean if we pass a 100+line file to fileExists |
03:05:41 | FromDiscord | <Yardanico> and stdout.write instead of echo because echo will always add an extra newline, but we want to print the content we got as-is (excluding the added color) |
03:15:44 | FromDiscord | <Yardanico> also neofetch doesn't work with this because neofetch itself has ANSI colors |
03:16:41 | FromDiscord | <Iliketwertles> just put that in the help thing as an example lol |
03:17:05 | FromDiscord | <Yardanico> did it work with your code? |
03:17:25 | FromDiscord | <Yardanico> i mean it's not hard to make it work, we just have to strip all the original ansi colors |
03:45:36 | * | arkurious quit (Quit: Leaving) |
03:56:02 | FromDiscord | <Iliketwertles> In reply to @Yardanico "did it work with": i think |
03:56:27 | FromDiscord | <Iliketwertles> nvm it messes up with some characters lol |
04:05:34 | * | azimut quit (Remote host closed the connection) |
04:07:31 | * | azimut joined #nim |
04:37:53 | * | azimut_ joined #nim |
04:41:44 | * | azimut quit (Ping timeout: 255 seconds) |
04:51:21 | FromDiscord | <Yardanico> btw, nim still compiles just fine with gcc with -std=c89 (-ansi) , there are only 2 thins (both in nimbase.h) that need change to make it compile with that - remove C++ style comments from nimbase.h (they're C99) and remove inline keyword for GCC (not present in C89) |
04:51:36 | FromDiscord | <Yardanico> although I only tested compiling the compiler itself |
05:07:43 | FromDiscord | <Elegantbeef> Could one make an inline noop macro? |
05:35:46 | NimEventer | New thread by guaracy: Any way to implement `=` in the follow exampĺe?, see https://forum.nim-lang.org/t/10019 |
06:03:24 | * | rmt joined #nim |
06:49:06 | * | mahlon quit (Ping timeout: 255 seconds) |
06:54:51 | * | mahlon joined #nim |
06:55:40 | FromDiscord | <sOkam!> In reply to @ripluke "what do i do": you put it in your nimble file, and replace each line with your source files and binaries you need to output |
06:56:05 | FromDiscord | <!&luke> Yea I figured it out |
06:56:09 | FromDiscord | <!&luke> Thx a lot tho |
06:56:15 | FromDiscord | <sOkam!> ah nice 👌 |
07:23:17 | * | Zevv joined #nim |
07:33:04 | NimEventer | New Nimble package! climinesweeper - Play MineSweeper on CLI, see https://github.com/KerorinNorthFox/MineSweeper_on_CLI |
08:04:32 | * | junaid_ joined #nim |
08:04:58 | * | tiorock joined #nim |
08:04:58 | * | tiorock quit (Changing host) |
08:04:58 | * | tiorock joined #nim |
08:04:58 | * | rockcavera is now known as Guest8617 |
08:04:58 | * | tiorock is now known as rockcavera |
08:05:56 | * | jmdaemon quit (Ping timeout: 250 seconds) |
08:07:39 | * | Guest8617 quit (Ping timeout: 248 seconds) |
08:49:08 | FromDiscord | <planetis> there are more terminal plotting libraries https://gitlab.com/OFThomas/nimtui |
08:55:36 | * | junaid_ quit (Remote host closed the connection) |
08:57:51 | FromDiscord | <planetis> In reply to @NimEventer "New Nimble package! noptics": this numerical package is amazing |
09:14:26 | NimEventer | New thread by gowthamanb: Background tasks in jester, see https://forum.nim-lang.org/t/10020 |
09:29:56 | FromDiscord | <sOkam!> Is there a way to access `arg0` from Nim code?↵_(i know about parseopts, but this is for gcnone)_ |
09:30:34 | FromDiscord | <sOkam!> (edit) "Is there a way to access ... `arg0`" added "C's" |
09:30:57 | FromDiscord | <sOkam!> (edit) "C's" => "the C main()" |
09:38:22 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/os.nim#L2956-L2965 |
10:03:46 | FromDiscord | <sOkam!> are those two a thing in C? never heard about thiem |
10:07:48 | FromDiscord | <sOkam!> wait, are those from C or from Nim's compiled code generation? |
10:18:02 | * | genpaku quit (Read error: Connection reset by peer) |
10:18:51 | * | genpaku joined #nim |
10:25:01 | * | rockcavera quit (Remote host closed the connection) |
10:31:25 | FromDiscord | <Yardanico> In reply to @sOkam! "wait, are those from": this, but they are literally mapped to argc/argv |
10:31:41 | FromDiscord | <Yardanico> <https://github.com/nim-lang/Nim/blob/devel/compiler/cgen.nim#L1480> |
10:36:08 | FromDiscord | <firasuke> how do you create multiple progress bars each updating on its own output line? |
10:47:22 | FromDiscord | <sOkam!> wait, posixCmain... is this not the same in windows? |
10:47:51 | FromDiscord | <sOkam!> (edit) removed "wait," | "not the same" => "name different" |
10:48:11 | FromDiscord | <sOkam!> (edit) "windows?" => "windows, @Yardanico?" |
10:55:10 | * | PMunch joined #nim |
11:09:33 | * | ltriant joined #nim |
11:29:48 | FromDiscord | <firasuke> what does `onProgressChanged` do? |
11:35:21 | PMunch | Wild guess is register a callback to be fired on progress change |
11:41:39 | * | junaid_ joined #nim |
11:56:57 | PMunch | Hmm, for my template thing I'm thinking of maybe creating a template engine generator |
11:57:36 | * | junaid_ quit (Remote host closed the connection) |
11:58:17 | PMunch | Basically a small framework for setting a start sequence, a stop sequence, an escape sequence, and a callback. The callback would then receive a called for each found template replacement part |
12:06:20 | * | rmt quit (Ping timeout: 246 seconds) |
12:40:44 | FromDiscord | <firasuke> In reply to @PMunch "Wild guess is register": oh ok thanks |
12:41:07 | FromDiscord | <firasuke> what's the default method for getting the basename from a path or a url? something like nix's `basename`? |
12:42:48 | FromDiscord | <firasuke> lastPathPart seems to be working fine, but if the var is a uri, should I use it? |
12:45:50 | FromDiscord | <Nerve> Has anyone done a comparison between disassemblies of Nim and of handwritten C? |
12:55:35 | FromDiscord | <federico3> what would you expect to see? |
13:09:04 | FromDiscord | <firasuke> what should you use asyncdispatch or chronos? |
13:14:27 | * | luis_ joined #nim |
13:35:35 | FromDiscord | <auxym> In reply to @firasuke "what's the default method": look at stuff in std/os, like splitPath etc |
13:37:12 | FromDiscord | <firasuke> In reply to @auxym "look at stuff in": ok thanks |
13:42:04 | * | sagax quit (Quit: Konversation terminated!) |
13:42:33 | FromDiscord | <auxym> for URIs we also have https://nim-lang.org/docs/uri.html |
13:42:37 | FromDiscord | <auxym> @firasuke |
13:43:17 | FromDiscord | <firasuke> I see, but what if I have a string that contains a uri, should I use splitPath from os, or parseUri then get the filename from the end using uri? |
13:43:18 | FromDiscord | <auxym> In reply to @firasuke "what should you use": no personal experience, but probably chronos. the stdlib async doesn't have great reputation |
13:44:28 | FromDiscord | <auxym> In reply to @firasuke "I see, but what": you have a URI that contains a filepath? I'd probably start with using the URI module to extract the path |
13:45:13 | FromDiscord | <firasuke> In reply to @auxym "you have a URI": alright, thanks for all the anwers |
13:45:15 | FromDiscord | <firasuke> much appreciated |
13:47:24 | FromDiscord | <auxym> note that std/os is dependent on the platform OS. eg. if your program is running on linux is you're trying to parse a Windows path it might do weird stuff |
13:47:45 | PMunch | @firasuke, probably use the URI module to get the path, then use lastPathPart on that: https://nim-lang.org/docs/uri.html |
13:47:50 | FromDiscord | <firasuke> In reply to @auxym "you have a URI": I have `someurl = "https://someurl.something/path/to/fileVersion.gz` I want to extract `fileVersion.gz` |
13:48:16 | FromDiscord | <firasuke> In reply to @PMunch "<@248208053952970752>, probably use the": epic I just found out about that, apparently I can use it on the string itself without parsing it as a uri |
13:48:57 | PMunch | You might be able to for a trivial string, but I wouldn't trust it unless you're absolutely sure it will work for any UR |
13:48:58 | PMunch | URI* |
13:49:09 | FromDiscord | <auxym> In reply to @firasuke "I have `someurl =": that's just a URI. you don't need to use std/os |
13:49:11 | FromDiscord | <firasuke> oh I see |
13:50:44 | FromDiscord | <firasuke> I have a bunch of async download functions that rely on `onProgressChanged` to `eraseLine` and output progress and stuff, however they are overwriting each others output, and I couldn't find a nice way to make each function's output on a separate line, while updating concurrently |
13:51:05 | FromDiscord | <firasuke> I realize I have to mess with cursor position, but it's getting tricky |
13:51:07 | FromDiscord | <auxym> I thought you meant something like `https://someurl.something/?path=c:\users\to\fileVersion.gz` |
13:51:15 | FromDiscord | <firasuke> In reply to @auxym "I thought you meant": oh sorry no |
13:51:32 | FromDiscord | <auxym> that would be "a URI containing a full file path" |
13:55:06 | FromDiscord | <firasuke> In reply to @firasuke "I have a bunch": I tried using some libraries like `progress` and `suru` but wasn't successful |
13:55:14 | FromDiscord | <firasuke> should I resort to threads? |
13:55:30 | FromDiscord | <firasuke> also are nim applications multithreaded by default? |
13:57:40 | * | nanxiao joined #nim |
14:01:32 | FromDiscord | <firasuke> `testament --print` isn't showing output when running single tests? |
14:13:50 | FromDiscord | <auxym> In reply to @firasuke "also are nim applications": depdends what you mean by multithreaded. nim devel / 2.0 has `--threads:on` by default, but it won't create threads and dispatch work for you |
14:14:42 | FromDiscord | <Ayy Lmao> How do I go about debugging a dll hosted in another program? I have been trying to use a c debugger but with no success so far. Right now when something bad happens the dll just silently crashes the program it is hosted in. I would at least like to be able to see the error messages. |
14:16:43 | FromDiscord | <firasuke> In reply to @auxym "depdends what you mean": I mean that if I run my nim application, I expect it to use all threads by default, not just one thread/logical cpu |
14:17:48 | FromDiscord | <auxym> yeah that's not happening. In fact I'm not sure I know any language that does that, except labview |
14:22:56 | FromDiscord | <firasuke> In reply to @auxym "yeah that's not happening.": oh ok |
14:48:47 | * | nanxiao quit (Quit: Client closed) |
14:50:03 | FromDiscord | <firasuke> where can I read more about the `--define` pragmas at compile time? also what's the difference between `--gc` and `--mm`? |
14:56:00 | FromDiscord | <Gumbercules> There is no difference to my knowledge |
14:56:16 | FromDiscord | <Gumbercules> mm is definitely newer but tmk just an alias |
14:56:51 | FromDiscord | <Gumbercules> The define pragmas allow to you to check for them in code with when defined(yourDefHere) |
14:57:02 | FromDiscord | <Gumbercules> Similar to C preprocessor defines |
14:57:23 | FromDiscord | <Gumbercules> Nim defines however are only available to Nim and not to C/C++ |
14:57:59 | FromDiscord | <Gumbercules> If you want to pass a define to the C preprocessor you'd do so with passC or compile a C source file that includes the define |
14:58:44 | FromDiscord | <Gumbercules> In reply to @firasuke "where can I read": Hope that helps - as usual the manual and tutorial are the best places to read more about any Nim feature. I know it can be painful to find what you're looking for at times though. |
14:58:50 | FromDiscord | <firasuke> I see, where can I find a list of available define switches? |
14:59:24 | FromDiscord | <Gumbercules> You can put whatever you want there |
14:59:36 | FromDiscord | <Gumbercules> There are no built-ins |
14:59:55 | FromDiscord | <Gumbercules> There are defines from the compiler and stdlib and user libri |
15:00:00 | FromDiscord | <Gumbercules> (edit) "libri" => "libraries" |
15:00:12 | FromDiscord | <Gumbercules> But it's not like you have to pick a define from a list |
15:00:26 | FromDiscord | <firasuke> what? |
15:00:34 | FromDiscord | <firasuke> what if I put a define that doesn't exist? |
15:00:43 | FromDiscord | <Gumbercules> I could define flippity floppity and the compiler would be fine |
15:01:01 | FromDiscord | <Gumbercules> Now it exists and I can check in code if it's defined |
15:01:17 | FromDiscord | <Gumbercules> With - when defined (flippityfloppity) |
15:01:32 | FromDiscord | <Gumbercules> Or if defined - when is a compile time check |
15:02:00 | FromDiscord | <Gumbercules> The same way C preprocessor defines work |
15:02:37 | FromDiscord | <Gumbercules> In reply to @Ayy Lmao "How do I go": Same answer I gave you yesterday unfortunately |
15:02:54 | FromDiscord | <Gumbercules> There's no magic way to get a DLL to behave different |
15:03:06 | FromDiscord | <firasuke> In reply to @Gumbercules "With - when defined": oh ok got it |
15:03:07 | FromDiscord | <firasuke> thanks |
15:03:18 | FromDiscord | <Gumbercules> You could try to write some hooks for segfaults |
15:03:58 | FromDiscord | <Gumbercules> But you're not going to stumble across some option that will make the DLL start to report errors in a more verbose way |
15:05:04 | FromDiscord | <Gumbercules> What trouble are you running into regarding the debugger route? Honestly, learning how to use a debugger is going to level you up and will allow you to debug issues much more efficiently. |
15:05:37 | FromDiscord | <Gumbercules> In reply to @firasuke "thanks": Np! Glad I could help |
15:05:39 | FromDiscord | <Rika> In reply to @firasuke "what if I put": Nothing happens |
15:06:59 | FromDiscord | <Gumbercules> Probably the only other thing I can think of would be to run the app with asan / valgrind |
15:07:36 | FromDiscord | <Gumbercules> Often these types of analyzers will also report memory access issues |
15:07:38 | FromDiscord | <auxym> In reply to @firasuke "I see, where can": https://nim-lang.org/0.20.0/nimc.html#additional-compilation-switches |
15:08:25 | FromDiscord | <Gumbercules> So if your program is crashing due to doing something bad in relation to memory, which is most likely the case, you might be able to find the issue that way |
15:08:44 | FromDiscord | <Gumbercules> But this is probably just as much work as using a debugger |
15:08:55 | FromDiscord | <Gumbercules> And isn't exclusive to using a debugger either |
15:09:13 | FromDiscord | <Gumbercules> If you're on Windows, debugging Nim programs is stupid easy as is memory analysis |
15:09:23 | FromDiscord | <firasuke> In reply to @auxym "https://nim-lang.org/0.20.0/nimc.html#additional-co": I found this:↵- https://nim-lang.org/docs/nimc.html↵- `nim --fullhelp` |
15:11:23 | FromDiscord | <firasuke> will `mimalloc` be available in future nim versions? |
15:11:41 | FromDiscord | <Gumbercules> I mean you can already use it |
15:11:51 | FromDiscord | <Gumbercules> It just requires some configuration |
15:12:13 | FromDiscord | <Gumbercules> But Araq just wrote a new general purpose allocator |
15:12:38 | FromDiscord | <Gumbercules> Last time I tried to use it, it crashed on Windows but I'm guessing that's fixed by now |
15:14:04 | FromDiscord | <Gumbercules> There's a thread on the forums about it. I'm on my phone atm otherwise I'd link you to it |
15:16:44 | FromDiscord | <Ayy Lmao> In reply to @Gumbercules "Same answer I gave": I actually miraculously got it working just now. The nim VSCode extension had some instructions on how to set it up that I was able to adapt. I am still not sure how to get stack traces but I can at least see where the code is failing now I think. |
15:17:14 | FromDiscord | <Gumbercules> What debugger are you using? |
15:17:25 | FromDiscord | <Gumbercules> I think for GDB it's bt |
15:17:38 | FromDiscord | <Ayy Lmao> LLDB, I wasn't able to get GDB to work |
15:17:45 | FromDiscord | <Gumbercules> To get a backtrace when paused |
15:18:45 | FromDiscord | <Gumbercules> It should be bt for LLDB too |
15:18:48 | FromDiscord | <Ayy Lmao> It is showing me where it crashed and when I click on certain areas it seems to be going to specific lines in code |
15:18:58 | FromDiscord | <Ayy Lmao> I am just not familiar with the interface |
15:19:25 | FromDiscord | <firasuke> In reply to @Gumbercules "But Araq just wrote": oh great, how do you use it? |
15:19:29 | FromDiscord | <Gumbercules> Gotcha, yeah I'm not either. I haven't used VS Code with LLDB or GDB before |
15:19:42 | FromDiscord | <firasuke> I saw somewhere that it was inspired from mimalloc |
15:19:45 | FromDiscord | <Gumbercules> In reply to @firasuke "oh great, how do": You probably already are |
15:19:57 | FromDiscord | <firasuke> https://nim-lang.org/blog/2022/11/11/a-cost-model-for-nim.html |
15:19:58 | FromDiscord | <Gumbercules> Especially if you're compiling with thread support |
15:20:11 | FromDiscord | <firasuke> oh cool, so no need to use mimalloc |
15:20:23 | FromDiscord | <Gumbercules> The old Nim allocator was not threadsafe |
15:20:40 | FromDiscord | <Gumbercules> If you're using a newer version of Nim, nope not needed |
15:20:57 | FromDiscord | <Gumbercules> Assuming that Windows bug is fixed / you don't care about Windows |
15:21:30 | FromDiscord | <firasuke> In reply to @Gumbercules "Assuming that Windows bug": exactly |
15:21:54 | FromDiscord | <firasuke> In reply to @Gumbercules "If you're using a": I am on 1.6.10 |
15:22:10 | FromDiscord | <Gumbercules> Sounds pretty new |
15:22:51 | FromDiscord | <Gumbercules> It should be easy to find out if you're on Windows. Just make a heap allocation and if your program doesn't crash with threads on you're probably fine. |
15:22:55 | FromDiscord | <firasuke> is there a speculated release date for nim 2.0? |
15:23:06 | FromDiscord | <Gumbercules> When it's ready I imagine |
15:23:53 | FromDiscord | <firasuke> awesome, thanks for taking the time to answer my many questions |
15:23:56 | FromDiscord | <firasuke> much appreciated |
15:25:35 | FromDiscord | <Gumbercules> No problemo |
15:26:24 | FromDiscord | <auxym> In reply to @firasuke "is there a speculated": araq has stated on the forum that there are two remaining "showstopper" bugs in ORC, once those are fixed then 2.0 will be released |
15:26:40 | FromDiscord | <Gumbercules> We had to wait years for 1.0 and it was always just around the corner. Scope creep is a bitch, and I think 2.0 will arrive sooner than later but you never know.... |
15:26:56 | FromDiscord | <firasuke> understandable |
15:26:58 | FromDiscord | <Gumbercules> Someone could get hit by a bus |
15:27:09 | FromDiscord | <firasuke> hopefully not lol |
15:27:10 | FromDiscord | <Gumbercules> And Nim definitely has some bus factor going for it |
15:27:17 | FromDiscord | <Gumbercules> Well yeah... |
15:27:22 | FromDiscord | <auxym> possibly just one remaining atm: https://github.com/nim-lang/Nim/labels/Showstopper |
15:32:25 | FromDiscord | <sOkam!> that list had like 7 just a couple of days ago 👀 👀 |
15:33:23 | FromDiscord | <firasuke> In reply to @auxym "possibly just one remaining": isn't this bug in ARC the older/previous mm model? |
15:35:28 | FromDiscord | <Yardanico> In reply to @firasuke "isn't this bug in": ARC is the new model |
15:35:29 | FromDiscord | <Yardanico> the old is refc |
15:35:41 | FromDiscord | <Yardanico> both ARC and ORC are new, ARC is the base and ORC is based on ARC and adds cycle collection |
15:38:36 | FromDiscord | <firasuke> Ahhh I see |
15:40:49 | FromDiscord | <Nilts> @ElegantBeef I solved the issue from yesterday, apparently, i was calling it, i forgot to remove the calls from the old structure |
15:41:37 | * | arkurious joined #nim |
15:50:40 | FromDiscord | <Nilts> But now I am getting this (different error):↵Error: attempting to call routine: 'resp`gensym14' |
16:00:59 | FromDiscord | <demotomohiro> @Nilts If you are usig `gensym`, it might being called with wrong kind: https://nim-lang.org/docs/macros.html#genSym%2CNimSymKind%2Cstring |
16:01:54 | FromDiscord | <Nilts> In reply to @demotomohiro "<@910899642236043294> If you are": I am not using gensym, i am using templates |
16:36:28 | * | luis_ quit (Quit: Leaving) |
16:39:06 | FromDiscord | <auxym> odd, IIRC templates don't gensym proc names by default |
16:49:02 | * | PMunch quit (Quit: leaving) |
17:21:02 | FromDiscord | <Nilts> In reply to @auxym "odd, IIRC templates don't": it is a template name, not a proc name |
17:32:14 | * | jmdaemon joined #nim |
17:46:51 | * | junaid_ joined #nim |
17:55:08 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4raj |
17:58:29 | FromDiscord | <sOkam!> hmm, just realized that the loop is just adding at the end, without inserting. totally wrong |
17:59:00 | FromDiscord | <Rika> `static array[...]`? |
17:59:31 | FromDiscord | <Rika> its not the same meaning as in C |
18:01:15 | FromDiscord | <sOkam!> don't know how to achieve the same, tbh |
18:03:58 | FromDiscord | <sOkam!> i guess i could compile it from some c file and import it, to avoid translating. feels like a hack, but might be simpler |
18:05:03 | Amun-Ra | C static in function? no equivalent, the closes is the method system/once uses, var foo {.global.}: … |
18:05:21 | Amun-Ra | https://github.com/nim-lang/Nim/blob/version-1-6/lib/system.nim#L3021-L3036 |
18:05:29 | FromDiscord | <Rika> maybe? |
18:05:31 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4ram |
18:05:50 | FromDiscord | <Rika> In reply to @Amun-Ra "C static in function?": or just use real globals or w/e |
18:05:58 | Amun-Ra | sure |
18:08:53 | FromDiscord | <sOkam!> In reply to @Amun-Ra "C static in function?": why exacly "closest" but not equivalent? |
18:09:25 | Amun-Ra | I was referring to static array inside the function |
18:09:54 | FromDiscord | <sOkam!> yeah, what i meant is why is that global pragma closest but not equivalent to C static |
18:10:10 | FromDiscord | <sOkam!> to me they look the exact same |
18:10:28 | Amun-Ra | it has global scope in Nim |
18:10:43 | FromDiscord | <sOkam!> oh i see |
18:11:00 | Amun-Ra | or 'file scope' in C terms |
18:11:26 | FromDiscord | <sOkam!> global has file scope or global scope? |
18:11:33 | FromDiscord | <sOkam!> that confused me |
18:11:42 | Amun-Ra | I mean in C these are the same |
18:12:28 | FromDiscord | <sOkam!> so global is actually global, like c file, but in nim file refers to the file itself only. is that correct? |
18:12:42 | FromDiscord | <sOkam!> mixing the terminology confused me a lot there |
18:13:11 | Amun-Ra | sorry, I shouldn't have used new term meaning the same as the other one |
18:13:46 | FromDiscord | <sOkam!> kk, makes sense then |
18:13:50 | FromDiscord | <sOkam!> tyty |
18:13:57 | Amun-Ra | in C there are four kinds of scopes: block scope, file scope, function scope and function prototype scope |
18:14:05 | Amun-Ra | global is file one |
18:14:55 | Amun-Ra | you can't have an object with static storage duration in file scope in nim |
18:15:19 | Amun-Ra | (apart from const ofc) ;> |
18:17:28 | FromDiscord | <jmgomez> any clean way to capture a global in a `cdecl`? |
18:20:21 | Amun-Ra | something like?: var foo {.importc, dynlib: ….}: ptr cint |
18:21:46 | FromDiscord | <jmgomez> dont follow, I also ment a non global |
18:21:56 | FromDiscord | <jmgomez> globals can be captured, but otherwise will just use a global |
18:21:59 | Amun-Ra | ah, I think I didn't get the question |
18:27:56 | FromDiscord | <sOkam!> If I add a local header file to a subfolder relative to the current `.nim` file where I'm calling for a `{.compile: ....}` pragma, where should that header file go so that the compiler knows how to read it? |
18:30:14 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rao |
18:30:44 | FromDiscord | <jmgomez> probably you need to add an abs path |
18:31:06 | FromDiscord | <sOkam!> oh, true with an `-I` |
18:31:37 | FromDiscord | <sOkam!> is there a pragma to do `--passC:...` from a file, instead of from the nim.cfg? |
18:31:51 | FromDiscord | <jmgomez> so the header has to be included but the c file I think it also needs a full path on the compile pragma |
18:32:14 | FromDiscord | <jmgomez> you could read it and pass it as argument to nim |
18:32:56 | FromDiscord | <sOkam!> last time i was using the compile pragma it wasn't needing a full path |
18:34:38 | FromDiscord | <sOkam!> wait, or maybe it did |
18:38:53 | Amun-Ra | s0kam: {.passc: "…".} |
18:39:44 | FromDiscord | <sOkam!> ty ✍️ |
18:39:49 | Amun-Ra | yw |
18:40:03 | Amun-Ra | btw, "ty" in polish means "you" ;) |
18:41:22 | FromDiscord | <sOkam!> lol didn't know |
18:45:04 | FromDiscord | <jmgomez> I always forgot, does it handle relatives then? |
18:46:20 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4ras |
18:51:26 | FromDiscord | <Hourglass [She/Her]> I want to continue working on the server but the shared library dependency system doesn't work and that's a bit annoying hm |
18:53:06 | Amun-Ra | do you have that audio plugin system in mind? |
18:55:58 | FromDiscord | <Hourglass [She/Her]> Audio plugin system? |
18:56:24 | Amun-Ra | than no, in that case ;> |
18:58:17 | FromDiscord | <Hourglass [She/Her]> What is that lol |
18:58:49 | Amun-Ra | I mean that must have been someone else |
18:59:00 | FromDiscord | <Hourglass [She/Her]> Ah yeah then probably |
18:59:18 | FromDiscord | <Hourglass [She/Her]> Mine is at https://github.com/Yu-Vitaqua-fer-Chronos/NimPluginSystem |
18:59:25 | FromDiscord | <Hourglass [She/Her]> I should probably polish it and make it into a library |
19:02:53 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4rau |
19:03:55 | FromDiscord | <jmgomez> In reply to @Hourglass, When the Hour Strikes "I want to continue": what doesnt work? I have a plugin dll system for NUE |
19:06:55 | FromDiscord | <sOkam!> In reply to @jmgomez "yeah, but you are": yes yes, i was totally misremembering. i was indeed using a full path before, like you mentioned |
19:08:06 | FromDiscord | <sOkam!> i checked the other code I had from before, and it was indeed using absolute paths. so i just reused that and it worked |
19:22:06 | FromDiscord | <Hourglass [She/Her]> Wait I can't uninstall my older Nimberite install |
19:22:10 | FromDiscord | <Hourglass [She/Her]> That is so odd what |
19:31:08 | * | junaid_ quit (Remote host closed the connection) |
19:31:10 | FromDiscord | <Hourglass [She/Her]> My project doesn't have that `requires` statement but Nimble still says that my project is depending on it |
19:32:42 | FromDiscord | <Hourglass [She/Her]> In reply to @jmgomez "what doesnt work? I": My issue was that a certain plugin field for the server (object) wasn't being set, but i can't fix it like this |
19:35:17 | FromDiscord | <Hourglass [She/Her]> Just used `rm` to clear that |
19:41:40 | * | pbsds6 joined #nim |
19:41:52 | * | pbsds quit (Ping timeout: 250 seconds) |
19:41:52 | * | pbsds6 is now known as pbsds |
19:42:26 | FromDiscord | <sramsay (Steve)> All the init procs for tables say, "Starting from Nim v0.20, tables are initialized by default and it is not necessary to call this function explicitly." So how does one create a new, empty table? Say, a new, empty OrderedTable? |
19:42:58 | * | derpydoo quit (Ping timeout: 276 seconds) |
19:46:07 | FromDiscord | <Hourglass [She/Her]> `var myOTbl: OrderedTable[string, string]` |
19:46:24 | FromDiscord | <Hourglass [She/Her]> Just using the type on an uninitialised variable |
19:50:34 | FromDiscord | <Hourglass [She/Her]> I can't be bothered to deal with my project now because Nimble keeps ignoring `nimble install` when compiling another project using that local library as a dependency |
19:54:21 | FromDiscord | <Hourglass [She/Her]> I have discovered `nimble develop` |
19:55:02 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4raL |
19:55:11 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4raM |
19:55:19 | FromDiscord | <Nilts> pls help, and ping on reply |
19:56:51 | FromDiscord | <Hourglass [She/Her]> Well Nimble develop is broken? |
19:57:03 | FromDiscord | <Hourglass [She/Her]> `Error: cannot open file: nimberitepkg/api/pluginmanager` even though `nimble install` makes this work just fine |
20:00:21 | FromDiscord | <sramsay (Steve)> In reply to @Hourglass, When the Hour Strikes "Just using the type": Thank you! |
20:00:45 | FromDiscord | <Hourglass [She/Her]> Np! |
20:43:18 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4rcN |
20:44:08 | FromDiscord | <Ayy Lmao> Not sure what to make of it, I mean it looks like it is accessing nil or something but I don't know how to find the cause of it. |
20:48:10 | FromDiscord | <hykq19> there seems to be a situation when framePtr.prev is nil but you try to access it anyway |
20:50:07 | FromDiscord | <Ayy Lmao> The thing is framePtr and this function is inside a nim compiler file, it's not something that I am interacting with in my code. |
20:52:50 | FromDiscord | <hykq19> segfaults are never very informative on their own, try using a debugger to see where exactly it is happening |
20:53:39 | FromDiscord | <Ayy Lmao> I am using LLDB in VSCode and that is what it is telling me. I am not sure how I can get it to be more informative about the error. |
20:55:10 | FromDiscord | <hykq19> LLDB is telling you that the error occurs when accessing framePtr.prev? |
20:55:38 | FromDiscord | <Ayy Lmao> Yeah it puts a yellow arrow there and that's where the execution stops. |
20:56:24 | FromDiscord | <hykq19> and in which file exactly is that code |
20:56:53 | FromDiscord | <Ayy Lmao> `excpt.nim` |
20:58:45 | FromDiscord | <hykq19> have you tried printing a stack trace to see what part of your code is accessing anything in excpt.nim |
20:58:58 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4rcP |
20:59:36 | FromDiscord | <Ayy Lmao> In reply to @hykq19 "have you tried printing": That's what I am trying to figure out how to do. I don't know how to do that. |
21:00:37 | FromDiscord | <michaelb.eth> when `importc`'ing a function from a C lib, if it's known to not have side-effects, is it appropriate to declare it in Nim with `func` instead of `proc`? |
21:00:37 | FromDiscord | <hykq19> try 'thread backtrace' |
21:02:18 | FromDiscord | <Ayy Lmao> sent a code paste, see https://paste.rs/z2b |
21:02:38 | FromDiscord | <Ayy Lmao> I am trying to get it to crash again so I can try that after it crashes |
21:05:19 | FromDiscord | <Elegantbeef> Yep↵(@michaelb.eth) |
21:05:32 | FromDiscord | <michaelb.eth> thanks |
21:08:37 | FromDiscord | <Ayy Lmao> In reply to @hykq19 "try 'thread backtrace'": That seems to give me some information. It is hard to tell what's going on still but I think I know the function that is causing it at least. |
21:09:48 | FromDiscord | <michaelb.eth> in what contexts is it appropriate/important to specify `noconv` instead of `cdecl` for a proc? |
21:11:52 | FromDiscord | <michaelb.eth> e.g. I'm writing a type def for a proc that will be a callback invoked by a C lib, is it better to use `noconv`? |
21:12:00 | FromDiscord | <michaelb.eth> (edit) "e.g. ... I'm" added "if" |
21:12:17 | NimEventer | New post on r/nim by boozzeeboom: Nim and leetcode, see https://reddit.com/r/nim/comments/11v0yc5/nim_and_leetcode/ |
21:30:45 | FromDiscord | <I have 50GB of nothing on my PC> how do you tell karax to chill out about a dom node managed by external code? |
21:34:40 | FromDiscord | <I have 50GB of nothing on my PC> setForeignNodeId |
21:34:42 | FromDiscord | <I have 50GB of nothing on my PC> thanks |
21:40:39 | FromDiscord | <I have 50GB of nothing on my PC> but how do you create js arrays from nim? |
21:49:59 | * | azimut_ quit (Ping timeout: 255 seconds) |
22:10:25 | * | terza joined #nim |
22:13:32 | * | ltriant quit (Ping timeout: 250 seconds) |
22:13:38 | * | terza left #nim (#nim) |
23:05:35 | * | beholders_eye joined #nim |
23:14:53 | FromDiscord | <michaelb.eth> I'm curious about this approach: https://github.com/nim-lang/Nim/issues/4441#issuecomment-230856546 |
23:16:15 | FromDiscord | <michaelb.eth> I realize that's from quite some time ago, but I was interested to see if it works, so was trying it with e.g. LC_COLLATE which in C++ is in the `<clocale>` header as opposed to `<locale.h>` |
23:17:42 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4rdq |
23:17:58 | arkanoid | this is the most confusing aspect of Nim asynchronous programming, in my opinion https://play.nim-lang.org/#ix=4rdo |
23:18:19 | FromDiscord | <michaelb.eth> there's probably something I don't understand about how to use that technique, or it no longer works with the C backend, or... |
23:18:42 | arkanoid | in almost all other programming languages futures are not executed until awaited, but Nim puts futures on the event loop no matter what |
23:19:23 | FromDiscord | <michaelb.eth> at least in JS, the same thing would happen if you invoke but don't await an async function |
23:20:30 | arkanoid | afaik, it does not happen in Rust, C#, Python |
23:21:02 | FromDiscord | <michaelb.eth> fwiw, same is true if you use nim-chronos instead of std/asyncdispatch |
23:21:08 | FromDiscord | <michaelb.eth> I mean behavior is the same |
23:22:01 | arkanoid | here the Rust docs for async https://doc.rust-lang.org/std/keyword.async.html "Use async in front of fn, closure, or a block to turn the marked code into a Future. As such the code will not be run immediately, but will only be evaluated when the returned future is .awaited." |
23:22:28 | FromDiscord | <michaelb.eth> yeah, that's definitely a different design |
23:23:11 | FromDiscord | <michaelb.eth> the way to think about it is that when you invoke an async proc, it begins running right away until it hits the first await inside it |
23:23:30 | FromDiscord | <michaelb.eth> at that point it returns control to the code that invoked it |
23:24:02 | arkanoid | this is very error prone, in my opinion |
23:25:58 | FromDiscord | <michaelb.eth> I can't really defend it vs. Rust, etc., but the way asyncdispatch/chronos does it is very familiar if you've done web/js programming, so I guess it's about trade-offs and having the right mental model for what it does |
23:27:45 | FromDiscord | <michaelb.eth> in chronos, there's `asyncSpawn` for when you don't intend to do anything with the returned Future |
23:27:46 | FromDiscord | <michaelb.eth> https://github.com/status-im/nim-chronos/blob/master/chronos/asyncfutures2.nim#L551 |
23:32:41 | arkanoid | here another example with Python https://play.nim-lang.org/#ix=4rdr |
23:33:27 | arkanoid | considering that "Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula." I'd like to do same test on Ada and Modula |
23:33:40 | arkanoid | but I don't know how to write those languages |
23:37:30 | FromDiscord | <alcatraz> anyone have good resources to learn nim |
23:39:52 | arkanoid | alcatraz, it depends on type of learner you are. If you like small incremental task, I suggest you exercism.io. If you like books, there are 3, one is online and free, one is paper or ebook, one is paper only |
23:49:04 | arkanoid | micharld.eth, I've asked in #ada, I'm quite curios |
23:51:12 | FromDiscord | <Elegantbeef> Arkanoid you know Nim that's like knowing Ada |
23:51:52 | arkanoid | Elegantbeef, really? |
23:53:59 | FromDiscord | <Elegantbeef> Ada and Nim share a lot |
23:55:25 | arkanoid | Elegantbeef, maybe, but I find quite hard to answer my question reading the manual section http://www.ada-auth.org/standards/12rm/html/RM-D-11.html |
23:57:14 | FromDiscord | <Elegantbeef> I was somewhat joking, didnt see this was concerning asnyc |
23:58:21 | arkanoid | I didn't get the /s |
23:58:50 | FromDiscord | <Elegantbeef> I was also somewhat sincere |
23:58:54 | FromDiscord | <Elegantbeef> Ada is very similar to Nim |