<< 18-03-2023 >>

 00:04:19 FromDiscord I get paid in exposure, not money 00:04:38 FromDiscord No one ever pays when I expose to them 00:04:44 FromDiscord Oddly i get a fine 00:04:54 FromDiscord Maybe we can arrange something 00:05:27 FromDiscord Are you not unattractive? 00:05:42 FromDiscord Lol 00:11:10 FromDiscord 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 Nope 00:12:22 FromDiscord darn 00:12:38 FromDiscord might just make it a seq 00:12:44 FromDiscord and not have a fixed length 00:12:56 FromDiscord I'd suggest just having the array of the largest size then implement [] that checks the length 00:13:01 FromDiscord well, not have the length enforced by the compiler 00:13:07 FromDiscord The largest size is going to be allocated likely anyway 00:13:16 FromDiscord oh yea good point 00:13:24 FromDiscord I'm curious can you share the typedef? 00:13:51 FromDiscord sent a code paste, see https://paste.rs/E6L 00:14:08 FromDiscord Oh lord jeebus 00:14:25 FromDiscord yea the sheer number is why i don't wanna have another case of lol 00:14:34 FromDiscord i have a proc for the length already 00:14:52 FromDiscord so i can just use that for the length instead of using len anywhere 00:15:41 FromDiscord 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 its for a genetic algorithm to make circuits i can't figure out 00:16:57 FromDiscord 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 I'd argue some of the branches do not make much sense 😄 00:17:40 FromDiscord i could remove the two spst switches 00:18:18 FromDiscord res, cap, capp, inductor are all the same branch 00:18:21 FromDiscord and maybe make power inputs a special case of signal inputs 00:18:30 FromDiscord Those could be merged together and you could write accessors or just access those names 00:18:49 FromDiscord so i think that will be necessary to have split apart for other stuff 00:18:57 FromDiscord i can always remove them later on 00:19:15 FromDiscord Yea i was just giving some insights to possibly make it less tall 00:19:43 FromDiscord It barely fits on my portrait monitor! 😛 00:20:08 FromDiscord same here 00:20:17 FromDiscord it doesn't fit in vscode 00:20:40 FromDiscord 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 another one \:) 00:41:43 FromDiscord 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 :pain: 00:48:51 FromDiscord welcome to programming 00:49:46 FromDiscord 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 (edit) "a" => "an entire" 00:50:29 FromDiscord 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 @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 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 God damn this bridge really likes to die 02:16:28 FromDiscord Nah it doesnt presently, need a to think about that 02:20:31 FromDiscord It does now 02:22:12 FromDiscord what do i do with this code? 02:22:29 FromDiscord With what code? 02:22:40 FromDiscord discord replies broke 02:23:06 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=2MXN 02:23:14 FromDiscord Gumber you use C style declarations more than I have ever is there anything else they do over there? 02:24:07 FromDiscord 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 newer C specifications introduced all sorts of fun init shortcuts 02:24:29 FromDiscord Sounds Fun 02:24:59 FromDiscord If it's not evident doing expressions stops positional from working 02:25:13 FromDiscord So like MyArr.init(myArr[0] = 300, 1) is invalid 02:25:28 FromDiscord yeah I figured as much 02:25:52 FromDiscord still better than nothing 02:25:58 FromDiscord or the alternative 02:27:06 FromDiscord why can this work fine when called in a pipe but doesnt print file contents till after you hit enter? 02:27:24 FromDiscord https://media.discordapp.net/attachments/371759389889003532/1086475913438433421/message.txt 02:30:51 FromDiscord prob something silly im missing 02:31:01 FromDiscord what's the supposed usage of this? 02:31:19 FromDiscord like how do I call it to test the stdin, just with no arguments or some other way? 02:32:02 FromDiscord just like the cat command 02:32:09 FromDiscord so a file path after it as a arg 02:36:43 * rockcavera quit (Remote host closed the connection) 02:38:54 FromDiscord well I think it's because you're trying to always read stdin 02:39:16 FromDiscord 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 not really 02:39:43 FromDiscord try taking out the while loop then? 02:39:47 FromDiscord thats kinda what i was thinking 02:39:56 FromDiscord that or how its reading stdin 02:40:29 * rockcavera joined #nim 02:42:21 FromDiscord well how about this for a start 02:42:27 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=2Nr6 02:42:42 FromDiscord 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 But but what about the race conditions! 😛 02:43:37 FromDiscord also judging your code you should check for paramCount == 3 for the color branch, not just 1 02:45:01 FromDiscord it broke codiums terminal 💀 02:45:21 FromDiscord fonts a little messed up https://media.discordapp.net/attachments/371759389889003532/1086480431895035934/screenshot_2023-03-17-224505.png 02:45:47 FromDiscord If it survives a reset get the flamethrower 02:45:55 FromDiscord also get a really crypted long output when i just put a string in like test 02:46:07 FromDiscord ill try to show 02:46:52 FromDiscord but its fine in a normal terminal 02:46:59 FromDiscord nvm then ig its codiums fault 02:47:54 FromDiscord In reply to @Yardanico "also it's easy to": i agree the structure of it before wasnt the best 02:47:57 FromDiscord i'm gonna move some code around in your case 03:01:27 FromDiscord how about something like this? I haven't tested it extensively, but still 03:01:48 FromDiscord @Iliketwertles https://play.nim-lang.org/#ix=2Ry7 03:03:16 FromDiscord ah right there's parseEnum instead of doing it with an option, smh 03:03:40 FromDiscord hm, but it will require changing some logic or outputting with the default color 03:04:20 FromDiscord 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 i mean if we pass a 100+line file to fileExists 03:05:41 FromDiscord 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 also neofetch doesn't work with this because neofetch itself has ANSI colors 03:16:41 FromDiscord just put that in the help thing as an example lol 03:17:05 FromDiscord did it work with your code? 03:17:25 FromDiscord 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 In reply to @Yardanico "did it work with": i think 03:56:27 FromDiscord 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 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 although I only tested compiling the compiler itself 05:07:43 FromDiscord 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 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 Yea I figured it out 06:56:09 FromDiscord Thx a lot tho 06:56:15 FromDiscord 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 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 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 Is there a way to access arg0 from Nim code?↵_(i know about parseopts, but this is for gcnone)_ 09:30:34 FromDiscord (edit) "Is there a way to access ... arg0" added "C's" 09:30:57 FromDiscord (edit) "C's" => "the C main()" 09:38:22 FromDiscord https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/os.nim#L2956-L2965 10:03:46 FromDiscord are those two a thing in C? never heard about thiem 10:07:48 FromDiscord 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 In reply to @sOkam! "wait, are those from": this, but they are literally mapped to argc/argv 10:31:41 FromDiscord 10:36:08 FromDiscord how do you create multiple progress bars each updating on its own output line? 10:47:22 FromDiscord wait, posixCmain... is this not the same in windows? 10:47:51 FromDiscord (edit) removed "wait," | "not the same" => "name different" 10:48:11 FromDiscord (edit) "windows?" => "windows, @Yardanico?" 10:55:10 * PMunch joined #nim 11:09:33 * ltriant joined #nim 11:29:48 FromDiscord 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 In reply to @PMunch "Wild guess is register": oh ok thanks 12:41:07 FromDiscord what's the default method for getting the basename from a path or a url? something like nix's basename? 12:42:48 FromDiscord lastPathPart seems to be working fine, but if the var is a uri, should I use it? 12:45:50 FromDiscord Has anyone done a comparison between disassemblies of Nim and of handwritten C? 12:55:35 FromDiscord what would you expect to see? 13:09:04 FromDiscord what should you use asyncdispatch or chronos? 13:14:27 * luis_ joined #nim 13:35:35 FromDiscord In reply to @firasuke "what's the default method": look at stuff in std/os, like splitPath etc 13:37:12 FromDiscord In reply to @auxym "look at stuff in": ok thanks 13:42:04 * sagax quit (Quit: Konversation terminated!) 13:42:33 FromDiscord for URIs we also have https://nim-lang.org/docs/uri.html 13:42:37 FromDiscord @firasuke 13:43:17 FromDiscord 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 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 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 In reply to @auxym "you have a URI": alright, thanks for all the anwers 13:45:15 FromDiscord much appreciated 13:47:24 FromDiscord 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 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 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 In reply to @firasuke "I have someurl =": that's just a URI. you don't need to use std/os 13:49:11 FromDiscord oh I see 13:50:44 FromDiscord 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 I realize I have to mess with cursor position, but it's getting tricky 13:51:07 FromDiscord I thought you meant something like https://someurl.something/?path=c:\users\to\fileVersion.gz 13:51:15 FromDiscord In reply to @auxym "I thought you meant": oh sorry no 13:51:32 FromDiscord that would be "a URI containing a full file path" 13:55:06 FromDiscord 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 should I resort to threads? 13:55:30 FromDiscord also are nim applications multithreaded by default? 13:57:40 * nanxiao joined #nim 14:01:32 FromDiscord testament --print isn't showing output when running single tests? 14:13:50 FromDiscord 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 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 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 yeah that's not happening. In fact I'm not sure I know any language that does that, except labview 14:22:56 FromDiscord In reply to @auxym "yeah that's not happening.": oh ok 14:48:47 * nanxiao quit (Quit: Client closed) 14:50:03 FromDiscord 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 There is no difference to my knowledge 14:56:16 FromDiscord mm is definitely newer but tmk just an alias 14:56:51 FromDiscord The define pragmas allow to you to check for them in code with when defined(yourDefHere) 14:57:02 FromDiscord Similar to C preprocessor defines 14:57:23 FromDiscord Nim defines however are only available to Nim and not to C/C++ 14:57:59 FromDiscord 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 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 I see, where can I find a list of available define switches? 14:59:24 FromDiscord You can put whatever you want there 14:59:36 FromDiscord There are no built-ins 14:59:55 FromDiscord There are defines from the compiler and stdlib and user libri 15:00:00 FromDiscord (edit) "libri" => "libraries" 15:00:12 FromDiscord But it's not like you have to pick a define from a list 15:00:26 FromDiscord what? 15:00:34 FromDiscord what if I put a define that doesn't exist? 15:00:43 FromDiscord I could define flippity floppity and the compiler would be fine 15:01:01 FromDiscord Now it exists and I can check in code if it's defined 15:01:17 FromDiscord With - when defined (flippityfloppity) 15:01:32 FromDiscord Or if defined - when is a compile time check 15:02:00 FromDiscord The same way C preprocessor defines work 15:02:37 FromDiscord In reply to @Ayy Lmao "How do I go": Same answer I gave you yesterday unfortunately 15:02:54 FromDiscord There's no magic way to get a DLL to behave different 15:03:06 FromDiscord In reply to @Gumbercules "With - when defined": oh ok got it 15:03:07 FromDiscord thanks 15:03:18 FromDiscord You could try to write some hooks for segfaults 15:03:58 FromDiscord 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 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 In reply to @firasuke "thanks": Np! Glad I could help 15:05:39 FromDiscord In reply to @firasuke "what if I put": Nothing happens 15:06:59 FromDiscord Probably the only other thing I can think of would be to run the app with asan / valgrind 15:07:36 FromDiscord Often these types of analyzers will also report memory access issues 15:07:38 FromDiscord In reply to @firasuke "I see, where can": https://nim-lang.org/0.20.0/nimc.html#additional-compilation-switches 15:08:25 FromDiscord 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 But this is probably just as much work as using a debugger 15:08:55 FromDiscord And isn't exclusive to using a debugger either 15:09:13 FromDiscord If you're on Windows, debugging Nim programs is stupid easy as is memory analysis 15:09:23 FromDiscord 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 will mimalloc be available in future nim versions? 15:11:41 FromDiscord I mean you can already use it 15:11:51 FromDiscord It just requires some configuration 15:12:13 FromDiscord But Araq just wrote a new general purpose allocator 15:12:38 FromDiscord Last time I tried to use it, it crashed on Windows but I'm guessing that's fixed by now 15:14:04 FromDiscord 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 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 What debugger are you using? 15:17:25 FromDiscord I think for GDB it's bt 15:17:38 FromDiscord LLDB, I wasn't able to get GDB to work 15:17:45 FromDiscord To get a backtrace when paused 15:18:45 FromDiscord It should be bt for LLDB too 15:18:48 FromDiscord 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 I am just not familiar with the interface 15:19:25 FromDiscord In reply to @Gumbercules "But Araq just wrote": oh great, how do you use it? 15:19:29 FromDiscord Gotcha, yeah I'm not either. I haven't used VS Code with LLDB or GDB before 15:19:42 FromDiscord I saw somewhere that it was inspired from mimalloc 15:19:45 FromDiscord In reply to @firasuke "oh great, how do": You probably already are 15:19:57 FromDiscord https://nim-lang.org/blog/2022/11/11/a-cost-model-for-nim.html 15:19:58 FromDiscord Especially if you're compiling with thread support 15:20:11 FromDiscord oh cool, so no need to use mimalloc 15:20:23 FromDiscord The old Nim allocator was not threadsafe 15:20:40 FromDiscord If you're using a newer version of Nim, nope not needed 15:20:57 FromDiscord Assuming that Windows bug is fixed / you don't care about Windows 15:21:30 FromDiscord In reply to @Gumbercules "Assuming that Windows bug": exactly 15:21:54 FromDiscord In reply to @Gumbercules "If you're using a": I am on 1.6.10 15:22:10 FromDiscord Sounds pretty new 15:22:51 FromDiscord 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 is there a speculated release date for nim 2.0? 15:23:06 FromDiscord When it's ready I imagine 15:23:53 FromDiscord awesome, thanks for taking the time to answer my many questions 15:23:56 FromDiscord much appreciated 15:25:35 FromDiscord No problemo 15:26:24 FromDiscord 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 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 understandable 15:26:58 FromDiscord Someone could get hit by a bus 15:27:09 FromDiscord hopefully not lol 15:27:10 FromDiscord And Nim definitely has some bus factor going for it 15:27:17 FromDiscord Well yeah... 15:27:22 FromDiscord possibly just one remaining atm: https://github.com/nim-lang/Nim/labels/Showstopper 15:32:25 FromDiscord that list had like 7 just a couple of days ago 👀 👀 15:33:23 FromDiscord In reply to @auxym "possibly just one remaining": isn't this bug in ARC the older/previous mm model? 15:35:28 FromDiscord In reply to @firasuke "isn't this bug in": ARC is the new model 15:35:29 FromDiscord the old is refc 15:35:41 FromDiscord both ARC and ORC are new, ARC is the base and ORC is based on ARC and adds cycle collection 15:38:36 FromDiscord Ahhh I see 15:40:49 FromDiscord @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 But now I am getting this (different error):↵Error: attempting to call routine: 'respgensym14' 16:00:59 FromDiscord @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 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 odd, IIRC templates don't gensym proc names by default 16:49:02 * PMunch quit (Quit: leaving) 17:21:02 FromDiscord 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 sent a code paste, see https://play.nim-lang.org/#ix=4raj 17:58:29 FromDiscord hmm, just realized that the loop is just adding at the end, without inserting. totally wrong 17:59:00 FromDiscord static array[...]? 17:59:31 FromDiscord its not the same meaning as in C 18:01:15 FromDiscord don't know how to achieve the same, tbh 18:03:58 FromDiscord 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 maybe? 18:05:31 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=4ram 18:05:50 FromDiscord 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 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 yeah, what i meant is why is that global pragma closest but not equivalent to C static 18:10:10 FromDiscord to me they look the exact same 18:10:28 Amun-Ra it has global scope in Nim 18:10:43 FromDiscord oh i see 18:11:00 Amun-Ra or 'file scope' in C terms 18:11:26 FromDiscord global has file scope or global scope? 18:11:33 FromDiscord that confused me 18:11:42 Amun-Ra I mean in C these are the same 18:12:28 FromDiscord 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 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 kk, makes sense then 18:13:50 FromDiscord 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 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 dont follow, I also ment a non global 18:21:56 FromDiscord 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 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 sent a code paste, see https://play.nim-lang.org/#ix=4rao 18:30:44 FromDiscord probably you need to add an abs path 18:31:06 FromDiscord oh, true with an -I 18:31:37 FromDiscord is there a pragma to do --passC:... from a file, instead of from the nim.cfg? 18:31:51 FromDiscord 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 you could read it and pass it as argument to nim 18:32:56 FromDiscord last time i was using the compile pragma it wasn't needing a full path 18:34:38 FromDiscord wait, or maybe it did 18:38:53 Amun-Ra s0kam: {.passc: "…".} 18:39:44 FromDiscord ty ✍️ 18:39:49 Amun-Ra yw 18:40:03 Amun-Ra btw, "ty" in polish means "you" ;) 18:41:22 FromDiscord lol didn't know 18:45:04 FromDiscord I always forgot, does it handle relatives then? 18:46:20 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=4ras 18:51:26 FromDiscord 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 Audio plugin system? 18:56:24 Amun-Ra than no, in that case ;> 18:58:17 FromDiscord What is that lol 18:58:49 Amun-Ra I mean that must have been someone else 18:59:00 FromDiscord Ah yeah then probably 18:59:18 FromDiscord Mine is at https://github.com/Yu-Vitaqua-fer-Chronos/NimPluginSystem 18:59:25 FromDiscord I should probably polish it and make it into a library 19:02:53 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=4rau 19:03:55 FromDiscord 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 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 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 Wait I can't uninstall my older Nimberite install 19:22:10 FromDiscord That is so odd what 19:31:08 * junaid_ quit (Remote host closed the connection) 19:31:10 FromDiscord My project doesn't have that requires statement but Nimble still says that my project is depending on it 19:32:42 FromDiscord 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 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 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 var myOTbl: OrderedTable[string, string] 19:46:24 FromDiscord Just using the type on an uninitialised variable 19:50:34 FromDiscord 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 I have discovered nimble develop 19:55:02 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=4raL 19:55:11 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=4raM 19:55:19 FromDiscord pls help, and ping on reply 19:56:51 FromDiscord Well Nimble develop is broken? 19:57:03 FromDiscord Error: cannot open file: nimberitepkg/api/pluginmanager even though nimble install makes this work just fine 20:00:21 FromDiscord In reply to @Hourglass, When the Hour Strikes "Just using the type": Thank you! 20:00:45 FromDiscord Np! 20:43:18 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=4rcN 20:44:08 FromDiscord 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 there seems to be a situation when framePtr.prev is nil but you try to access it anyway 20:50:07 FromDiscord 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 segfaults are never very informative on their own, try using a debugger to see where exactly it is happening 20:53:39 FromDiscord 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 LLDB is telling you that the error occurs when accessing framePtr.prev? 20:55:38 FromDiscord Yeah it puts a yellow arrow there and that's where the execution stops. 20:56:24 FromDiscord and in which file exactly is that code 20:56:53 FromDiscord excpt.nim 20:58:45 FromDiscord have you tried printing a stack trace to see what part of your code is accessing anything in excpt.nim 20:58:58 FromDiscord sent a code paste, see https://play.nim-lang.org/#ix=4rcP 20:59:36 FromDiscord 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 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 try 'thread backtrace' 21:02:18 FromDiscord sent a code paste, see https://paste.rs/z2b 21:02:38 FromDiscord I am trying to get it to crash again so I can try that after it crashes 21:05:19 FromDiscord Yep↵(@michaelb.eth) 21:05:32 FromDiscord thanks 21:08:37 FromDiscord 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 in what contexts is it appropriate/important to specify noconv instead of cdecl for a proc? 21:11:52 FromDiscord 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 (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 how do you tell karax to chill out about a dom node managed by external code? 21:34:40 FromDiscord setForeignNodeId 21:34:42 FromDiscord thanks 21:40:39 FromDiscord 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 I'm curious about this approach: https://github.com/nim-lang/Nim/issues/4441#issuecomment-230856546 23:16:15 FromDiscord 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  header as opposed to  23:17:42 FromDiscord 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 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 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 fwiw, same is true if you use nim-chronos instead of std/asyncdispatch 23:21:08 FromDiscord 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 yeah, that's definitely a different design 23:23:11 FromDiscord 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 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 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 in chronos, there's asyncSpawn for when you don't intend to do anything with the returned Future 23:27:46 FromDiscord 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 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 Arkanoid you know Nim that's like knowing Ada 23:51:52 arkanoid Elegantbeef, really? 23:53:59 FromDiscord 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 I was somewhat joking, didnt see this was concerning asnyc 23:58:21 arkanoid I didn't get the /s 23:58:50 FromDiscord I was also somewhat sincere 23:58:54 FromDiscord Ada is very similar to Nim