<< 29-03-2022 >>

00:00:16FromDiscord<auxym> probably way easier to link that in via relative paths, compared to trying to figure the nimble package dir
00:00:48nrds<Prestige99> but link how, is the question
00:01:39FromDiscord<auxym> passL?
00:02:03FromDiscord<auxym> I used in .compile. in a project to compile-in a C file based on a compile-time define
00:02:29FromDiscord<huantian> In reply to @salt "yeah, the error doesn't": hm actually that's weird, why is ord not a procvar
00:02:44nrds<Prestige99> You're saying like in a pragma? I haven't done that before
00:03:38FromDiscord<auxym> yeah. for compile I had to use a macro to generate a pragma but you might not have to.
00:03:40FromDiscord<auxym> https://github.com/auxym/nim-on-samd21/blob/master/src/startup.nim
00:04:35FromDiscord<huantian> In reply to @huantian "hm actually that's weird,": I think it is that ord is a magic builtin that can't be passed around like that, and the error message is outdated
00:04:38FromDiscord<auxym> the startup.c file path it's passing in is relative to the project build dir, too.
00:06:15FromDiscord<auxym> try adding {.passL: "-L./relative/path/to/your/so".} at the top of the file that needs those
00:08:02nrds<Prestige99> in the library, or in the project using the library?
00:08:13FromDiscord<exelotl> sent a long message, see http://ix.io/3TKe
00:09:32LuxuryModeIs `os.commandLineParams` the best way to fetch command line params or is there some other preferred proc or approach for this?
00:10:12FromDiscord<spoon> now how do i make a macro to make the xor keyword real 😢
00:10:32nrds<Prestige99> LuxuryMode I use https://nim-lang.org/docs/parseopt.html
00:10:39FromDiscord<auxym> In reply to @nrds "<Prestige> in the library,": Prestige: since linking is a single call (I think?), I think anywhere you put it would result in nim adding it to its linker call
00:10:46FromDiscord<exelotl> In reply to @spoon "now how do i": I'm pretty sure the language has an xor keyword 😅
00:11:06FromDiscord<auxym> you can compile with `-v` to see nim's gcc command lines
00:11:08LuxuryModenrds: ah beautiful, was looking for something like this. Thank you!
00:11:21nrds<Prestige99> Hm I'll try it in the "main" module of the libary then
00:11:22FromDiscord<spoon> i meant nxor
00:11:36FromDiscord<spoon> :)
00:11:38FromDiscord<auxym> LuxuryMode: I think the cligen library is also pretty popular
00:12:12FromDiscord<exelotl> ah
00:12:15FromDiscord<huantian> it might just be easier to bitwise not then xor lol
00:12:49LuxuryModethanks auxym
00:12:51FromDiscord<spoon> lol, just being able to define things that take arguments on either side have been on my wishlist for some reason
00:12:52FromDiscord<auxym> In reply to @spoon "i meant nxor": `template nxor(a, b: untyped): untyped = not (a xor b)`?
00:13:24FromDiscord<spoon> hm
00:13:34FromDiscord<huantian> you could just deal with having to type an extra period
00:13:52FromDiscord<auxym> In reply to @spoon "hm": nim actually implements a lot of its own stuff that way: https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/comparisons.nim#L128
00:14:11FromDiscord<spoon> ye, i've seen the magic pragma before
00:14:19FromDiscord<spoon> havent read for a while though
00:14:42FromDiscord<auxym> no magic there, it's just a template
00:14:51FromDiscord<huantian> sent a code paste, see https://paste.rs/Ftn
00:15:24*crem quit (Ping timeout: 240 seconds)
00:16:29FromDiscord<spoon> In reply to @auxym "no magic there, it's": yea, nim has a special set of characters that work that way though
00:16:29FromDiscord<auxym> oh yeah you're right about that
00:17:15*crem joined #nim
00:17:34*nrds quit (Remote host closed the connection)
00:21:00FromDiscord<huantian> Who needs bitwise xnor when you can just use a loop and !=
00:21:11*nrds joined #nim
00:21:38*077AAIBZ5 joined #nim
00:21:38*077AAIBZ5 quit (Remote host closed the connection)
00:22:05FromDiscord<auxym> haha
00:22:23FromDiscord<auxym> would gcc optimize that to an xnor? 😄
00:23:31FromDiscord<demotomohiro> x86_64 or arm have xnor instruction?
00:24:00FromDiscord<demotomohiro> As far as I know, they have and, or, xor
00:27:04LuxuryModeIs there a unit type in Nim, e.g. `proc doSomething(): Unit = echo "whatever"` or is this https://nim-lang.org/docs/manual.html#types-procedural-type basically what I'm dealing with?
00:28:11FromDiscord<huantian> I think you just do `proc()` yeah
00:28:35LuxuryModethanks
00:28:41LuxuryModeAlso, is there a REPL for Nim?
00:33:41FromDiscord<auxym> inim works OK
00:34:36FromDiscord<auxym> not sure why they don't merge this so it compiles on 1.6 though 😦 https://github.com/inim-repl/INim/pull/131
00:35:53FromDiscord<auxym> meanwhile you can `nimble install https://github.com/auxym/INim@#update-cligen`
00:40:34LuxuryModethanks auxym
00:42:33LuxuryModehmm, where exactly does nimble install that? Seems I need to add some dir to my path
00:43:36FromDiscord<auxym> on linux it's `~/.nimble/bin`
00:44:32FromDiscord<huantian> I think you can also do `nim secret`
00:49:57LuxuryModethanks
00:50:03LuxuryModeHow do I get out of nim secret? :P
00:50:31LuxuryModeah `quit()`
00:55:10FromDiscord<exelotl> `nim secret` uses Nimscript (the subset of Nim that works at compile time), so it'll probably fall over as soon as you import something that wasn't made with Nimscript in mind
00:55:41FromDiscord<exelotl> That's why it's secret
01:00:08FromDiscord<auxym> ah, yeah. inim compiles everything on the fly with tcc
01:21:30*neurocyte1 joined #nim
01:23:07*noeontheend joined #nim
01:23:50*neurocyte quit (Ping timeout: 252 seconds)
01:23:50*neurocyte1 is now known as neurocyte
01:29:16FromDiscord<Elegantbeef> So debian sid is fun 😛
01:29:42FromDiscord<Elegantbeef> Let's just say gnome isnt very compatible with it due to python being shit
01:34:08FromDiscord<Girvo> In reply to @Elegantbeef "<@823468778704076810>\: still debugging macro?": Yeah. I can't seem to get my head around how to make a macro pragma replace itself with the codegenDecl pragma in a variable definition
01:34:24FromDiscord<Elegantbeef> What do you have presently?
01:34:39FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3TKl
01:34:44FromDiscord<Elegantbeef> `[4]` is wrong
01:35:05FromDiscord<Girvo> Yeah I thought so. I think it needs to be `[2]` or `[1]` based on the dumptree I got?
01:35:18FromDiscord<Elegantbeef> Not only that but in 1.6 and below variable macros are written `macro rtcNoInit(lh, rh, ex: untyped)`
01:36:21FromDiscord<Girvo> Ahhhhh
01:36:22FromDiscord<Girvo> Sweet
01:36:32FromDiscord<Girvo> Alright I'll start again I think
01:36:47FromDiscord<Elegantbeef> Also i did make your macro in micros for fun 😛
01:36:59FromDiscord<Girvo> Hah how does it look in micros?
01:37:14FromDiscord<Elegantbeef> https://github.com/beef331/micros/blob/master/tests/test2.nim#L5-L14
01:37:16FromDiscord<Girvo> Once I get it working in straight std/macros, it'll be fun to compare
01:37:36FromDiscord<Girvo> ugh thats so much cleaner to understand haha
01:37:49FromDiscord<Elegantbeef> That's the point
01:38:04FromDiscord<Elegantbeef> Oh god trying to use a floating window manager after using i3wm for so long is interesting
01:38:39FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3TKm
01:38:51FromDiscord<Elegantbeef> Yea you can
01:38:53FromDiscord<Girvo> Haha man I force my floating WM to act like a tiling one. I refuse to give it up
01:39:00FromDiscord<Elegantbeef> you can make it so `ex` has to be `nnkNilLit`
01:39:06FromDiscord<Girvo> Ah neat
01:39:19FromDiscord<Elegantbeef> Eh i'm just trying debian sid a try cause i was pissed off with some ubuntu packages
01:39:46FromDiscord<Girvo> Because RTC_NOINIT_ATTR's whole deal is that you don't initialise it, it "carries over" memory from its previous execution/boot
01:39:51FromDiscord<Elegantbeef> Easier to use a normal DE than i3wm for testing
01:39:59FromDiscord<Girvo> (Well, you don't initialise it always, I guess)
01:40:07FromDiscord<Girvo> And yeah thats fair enough
01:40:55FromDiscord<Elegantbeef> if you want to enforce no intializing just do `if ex.kind != nnkNilLit: error("You should know better no intializing RTC vars", ex)`
01:42:56FromDiscord<Girvo> Haha thats basically exactly what I just wrote
01:50:14FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3TKs
01:50:30FromDiscord<Elegantbeef> In the above yes
01:50:41FromDiscord<Elegantbeef> `rh` can be any valid type so `nnkBracket` is allowed
01:50:45FromDiscord<Elegantbeef> Even `nnkCall`
01:52:34FromDiscord<Girvo> Alright. I need to go read some macro docs/examples I think. Been far too long since I tackled them
01:52:54FromDiscord<Elegantbeef> shamelessly links my writeup again
01:53:10FromDiscord<Girvo> Haha thats what I'm going through 😉
01:53:19FromDiscord<Girvo> (That and dom's book)
02:01:56*ltriant_ quit (Ping timeout: 272 seconds)
02:02:57FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3TKv
02:03:29FromDiscord<Elegantbeef> Well i'd suggest using `genasts` instead of quote now but the above should work
02:03:30FromDiscord<Girvo> Only if I remove the `ex.kind != nnkNilLit` though, as if I don't remove it, it picks up the _next_ statement if I don't have `= nil`
02:03:54FromDiscord<Girvo> Oh for sure, this is just a first pass to make sure I understand what it's doing
02:04:08FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/5X5
02:04:35FromDiscord<Girvo> Oh nice
02:04:45FromDiscord<Elegantbeef> `import std/genasts` for that
02:04:49FromDiscord<Elegantbeef> anyway what's the issue?
02:05:25FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3TKw
02:05:30FromDiscord<Girvo> https://media.discordapp.net/attachments/371759389889003532/958185100758102036/unknown.png
02:05:40FromDiscord<Girvo> https://media.discordapp.net/attachments/371759389889003532/958185143565176923/unknown.png
02:06:48FromDiscord<Girvo> And lastly
02:06:49FromDiscord<Elegantbeef> Full code?
02:06:49FromDiscord<Girvo> https://media.discordapp.net/attachments/371759389889003532/958185430744985640/unknown.png
02:07:25FromDiscord<Girvo> https://pastebin.com/hn4gvsUn
02:07:32FromDiscord<Girvo> ^ full code for that module
02:08:05FromDiscord<Elegantbeef> `nnkEmpty` is the kind
02:08:09FromDiscord<Girvo> Ah!
02:08:16FromDiscord<Girvo> Man I'm a moron sometimes
02:08:26FromDiscord<Elegantbeef> Hey i lied to you
02:08:41FromDiscord<Girvo> yeah but I should've picked up on it
02:08:46FromDiscord<Girvo> I have the dumptree in front of me lol
02:08:57FromDiscord<Girvo> _telling_ me it needs to be Empty not Nil lol
02:09:36FromDiscord<Girvo> Now the only interesting thing is that `Error Type` business. It seems the `int` type itself is "lost" somewhere through this macro? At least for autocomplete anyway. Maybe it doesn't matter much
02:10:01FromDiscord<Elegantbeef> It's an untyped macro
02:10:01FromDiscord<Girvo> If I try to assign a string to it, Nim of course complains correctly
02:10:29*Zectbumo quit (Read error: Connection reset by peer)
02:10:40FromDiscord<Girvo> Right so there is not much that can be done there
02:11:16FromDiscord<Girvo> Well, good enough for a first pass anyway. The C output is correct, and actual usage of the variable is correct and type checked 🙂
02:11:42*Zectbumo joined #nim
02:12:40FromDiscord<Girvo> I can't remember ever writing a full typed macro myself lol
02:12:57FromDiscord<Elegantbeef> You use them alot for introspective heavy code
02:13:57FromDiscord<Girvo> Yeah, would be super handy for certain DSLs I could imagine
02:14:53FromDiscord<Elegantbeef> I use them for the nimscripter bridge, cant beat that introspection 😛
02:18:06FromDiscord<huantian> Too bad I can’t make a typed macro for myself
02:18:15FromDiscord<Elegantbeef> Lol
02:18:19FromDiscord<Girvo> Whats the impact of this on my variable pragma macro? https://github.com/nim-lang/Nim/commit/2bd1aa186e09565b2103394bd281478fa1b10ef1
02:18:42FromDiscord<Girvo> Is it supposed to use the unary node rather than triplet now?
02:19:00FromDiscord<Girvo> (I was reading through this: https://github.com/nim-lang/RFCs/issues/220)
02:19:24FromDiscord<Elegantbeef> you later wrap it with a when block and support both
02:20:37FromDiscord<Elegantbeef> Atleast you ideally want to support stable and open yourself up to devel imo
02:21:33FromDiscord<Girvo> > Given how simple these changes are I'm worried if I'm missing something.↵Haha, I feel that, Araq. All the damned time.
02:21:47FromDiscord<Girvo> Ahhhh right, I'm with you
02:22:29FromDiscord<Girvo> Yeah once I can wrap up a lot of what I've added and bring it into an updated Nesper, I will need to. Though some of Nesper needs to be brought up to date with devel as well I believe
02:23:21FromDiscord<Girvo> Is that change not in 1.6.2 yet?
02:23:34nrds<Prestige99> Setting LD_LIBRARY_PATH to my path with .so files works, but using --passL"-L{thePath}" does not. Am I missing something here?
02:23:43FromDiscord<Girvo> (edit) "1.6.2" => "1.6.4"
02:23:48FromDiscord<Elegantbeef> Nope it's devel will be a change in next version afaik
02:23:53FromDiscord<Girvo> Ahhhh cool
02:23:56FromDiscord<Elegantbeef> so `1.8` or `2.0` whatever comes first
02:24:18FromDiscord<Elegantbeef> also stable is at 1.6.4
02:24:18FromDiscord<Girvo> I'm tempted to switch to devel and see what works/breaks. I'll put it on my todo list and take a crack at some point
02:24:33FromDiscord<Girvo> Yeah I edited my comment haha, I misremembed the sub version
02:24:34FromDiscord<Elegantbeef> A majority of stuff will wrok
02:24:38FromDiscord<Elegantbeef> work perhaps
02:25:04FromDiscord<Girvo> Yeah I expect it will. I'm curious about Nesper, it was written against v1.4 originally
02:25:25FromDiscord<Elegantbeef> Mostly going to just get warnings, less so errors
02:30:17FromDiscord<Patitotective> @ElegantBeef while you were calling my design wacky, i was working on it https://github.com/Patitotective/ImTemplate https://media.discordapp.net/attachments/371759389889003532/958191335641346108/prefsmodal1.png https://media.discordapp.net/attachments/371759389889003532/958191335825879121/main.png https://media.discordapp.net/attachments/371759389889003532/958191336043970570/aboutmodal.png
02:30:41FromDiscord<Patitotective> (edit) "@ElegantBeef while you were calling my design wacky, i was working on it ... https://github.com/Patitotective/ImTemplate" added "lmao"
02:30:55nrds<Prestige99> Does --passL not work with 1.6.4 or something?
02:31:04FromDiscord<Elegantbeef> It does
02:32:09FromDiscord<Elegantbeef> Patito you dont use the wacky design though do you?
02:32:32FromDiscord<Patitotective> In reply to @Elegantbeef "Patito you dont use": not the callback stuff
02:32:53FromDiscord<Elegantbeef> You use the proper return value and a buffer
02:32:55FromDiscord<Elegantbeef> Good
02:33:51FromDiscord<Alexis> sent a code paste, see https://play.nim-lang.org/#ix=3TKz
02:33:57FromDiscord<Elegantbeef> That's the way to do it
02:34:14nrds<Prestige99> Elegantbeef: okay help me understand this then - I'm building with `--passL="-L.usr/lib/"` where `libSDL2_gpu.so` lives at`.usr/lib/libSDL2_gpu.so`, but when at runtime I get `libSDL2_gpu.so: cannot open shared object file: No such file or directory`
02:34:42nrds<Prestige99> I've tried absolute paths, no trailing `/` etc
02:34:48FromDiscord<Elegantbeef> that's for compile linking
02:35:18FromDiscord<Patitotective> In reply to @Elegantbeef "That's the way to": 🙃 still im not convinced about how im managing the "cache", im almost i can make it work without it but huh
02:35:25FromDiscord<Elegantbeef> add the file to your `LD_LIBRARY_PATH=".usr/lib" myBinaryName`
02:35:26FromDiscord<Patitotective> (edit) "almost" => "sure"
02:35:55nrds<Prestige99> ah that's what I had originally but I can't make my library enforce that for the users of said library.. back to square one
02:35:55*noeontheend quit (Ping timeout: 246 seconds)
02:36:14FromDiscord<Elegantbeef> What do you mean?
02:36:36nrds<Prestige99> If someone uses my library they will need that env variable set to use it
02:36:55nrds<Prestige99> or maybe there's another way but I haven't found one, yet
02:37:37FromDiscord<Elegantbeef> I dont follow the issue
02:38:09nrds<Prestige99> If someone uses my library they won't be able to run/compile their program if the LD_LIBRARY_PATH isn't set
02:38:26nrds<Prestige99> trying to solve this on my library's end instead of telling everyone to set up this path
02:41:02FromDiscord<Elegantbeef> I mean you're dynamic linking you either have the library in the system path or in a path provided with ldlibpath
02:41:19FromDiscord<Elegantbeef> So either the library is beside the binary, in `lib` or in the libpath
02:41:49FromDiscord<Elegantbeef> You can always make a shell script or use a nimble task to get it in there
02:41:54FromDiscord<Elegantbeef> Or make your own build tool
02:42:15nrds<Prestige99> was hoping there was a way to do this with nimble but haven't seen a way yet
02:42:40FromDiscord<Elegantbeef> Follow the impbox way and make your own build tool
02:42:47nrds<Prestige99> hm perhaps
02:43:02nrds<Prestige99> Was hoping nimble could link more than just the binary
02:43:32FromDiscord<Elegantbeef> I dont know what you mean by that
02:44:22nrds<Prestige99> Like it links a binary, but if I could have it also add the .so files to the path that would solve my issue
02:44:57nrds<Prestige99> hmm might have found an option
02:56:21nrds<Prestige99> nvm idk what this nimble documentation means
03:00:33*ltriant joined #nim
03:03:01FromDiscord<Girvo> Could you not use `putEnv` to adjust the env var, if thats what you mean by PATH?
03:03:48FromDiscord<Girvo> Though finding shared libraries is an OS packaging problem more so than anything else
03:06:53nrds<Prestige99> The libs are shipped with the library, I'm just having a hard time setting them up for some reason
03:07:02FromDiscord<Girvo> If it's dynamically linked and you want to make sure its there (and you redistribute the library), you solve that by packaging the library in a known place, and baking that relative path into your compile. Or, on macOS, you just put it in the right spot in the application bundle haha 🙂
03:07:38nrds<Prestige99> I just need LD_LIBRARY_PATH which I can configure in config.nims for the library's development, but when something else uses that library, the path doesn't get set
03:09:14FromDiscord<Girvo> Tbh I wouldn't want a library messing with my LD_LIBRARY_PATH automatically anyway myself haha. It'll break some of my C projects if it's not careful 😉 But thats my and my weird use-cases, I get what you are after. I swear theres a better way than LD_LIBRARY_PATH though, I looked into a lot of this when I was doing macOS application dev in Nim, but I can't find the project sadly
03:10:46FromDiscord<Girvo> `-Wl,-rpath,'$ORIGIN/../lib'` is the better way of doing it if this was C. @ElegantBeef theres a way to do those exact linker options in Nim no? I remember there was
03:11:10FromDiscord<Elegantbeef> `passL` pragma
03:12:33FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3TKE
03:13:44FromDiscord<Girvo> This should let users still override which library its linked against via LD_LIBRARY_PATH or LD_PRELOAD as well, but have it work in the default case as long as you package the `.so` files next to the binary
03:13:54FromDiscord<Girvo> Unless I'm misunderstanding what you're trying to achieve!
03:15:55nrds<Prestige99> It would only be the LD_LIBRARY_PATH for the running program so it should be fine eh
03:16:04FromDiscord<Girvo> Actually you might not even need `-Wl` I think that you just do `-rpath,'$ORIGIN/../path/to/wherever;`
03:16:17FromDiscord<Girvo> (edit) "`-rpath,'$ORIGIN/../path/to/wherever;`" => "`-rpath,'$ORIGIN/../path/to/wherever'`"
03:17:11FromDiscord<Girvo> Like, yeah, I guess haha. But `rpath` is the "proper" way to do it
03:17:45nrds<Prestige99> hm will have to look up what that is
03:18:37FromDiscord<Girvo> rpath tells the linker where it should be looking for your shared libraries 🙂 It's basically LD_LIBRARY_PATH but baked into the binary, rather than messing with env vars
03:20:05FromDiscord<demotomohiro> You can ask Nim to pass that linker option to gcc with `--passL`.
03:20:23FromDiscord<Elegantbeef> demo is a few messages behind
03:20:27FromDiscord<Elegantbeef> They'll catch up eventually
03:20:46FromDiscord<Girvo> hah. `--passL` doesn't need `-Wl` right, thats implied?
03:21:02FromDiscord<Elegantbeef> no clue i dont play with the C compiler
03:21:05FromDiscord<Girvo> As passL _is_ linker options
03:21:14FromDiscord<Girvo> And `-Wl` is telling GCC "here are the linker options" lol
03:22:07FromDiscord<demotomohiro> Nim uses gcc as linker so you still need to pass `-wl` to `--passL`.
03:22:16FromDiscord<Girvo> Okay good to know!
03:22:40FromDiscord<Girvo> @nrds what relative path are your shared libraries being placed in?
03:22:53FromDiscord<Girvo> Asked a better way: what are you trying to set LD_LIBRARY_PATH to right now?
03:23:06FromDiscord<Elegantbeef> No his name is prestige
03:23:10FromDiscord<Elegantbeef> Nrds is the bridge
03:23:15FromDiscord<Elegantbeef> Cmon girvo i believe in you
03:23:17FromDiscord<Girvo> lol
03:23:32FromDiscord<Girvo> I need another coffee
03:23:41FromDiscord<Elegantbeef> But it's 2133
03:23:58FromDiscord<Girvo> 1333 for me 😉
03:24:16FromDiscord<Elegantbeef> Sucks to suck
03:25:20FromDiscord<Girvo> hahaha. Anyway @prestige -- whats the path you're setting LD_LIBRARY_PATH to? I can give you the `--passL` you're after, and you can either do it as a nim.cfg build arg, nimble build arg, or do it as a pragma in your library code 🙂
03:26:32nrds<Prestige99> So --passL works for the build step but not when I'm using the library in another project, apparently
03:26:43nrds<Prestige99> relative to the project it's `.usr/lib`
03:26:44FromDiscord<Girvo> I found my old project! And yep, `rpath` as a passL linker option is exactly how I did it lol
03:27:37nrds<Prestige99> well i was just using -L
03:27:54FromDiscord<Girvo> @Prestige okay cool, where is the binary going to be output to? the top level? `./binary`, then `./.usr/lib/`?
03:28:12nrds<Prestige99> wherever nimble puts it I suppose
03:29:01FromDiscord<Girvo> -L is still needed, thats what tells it what SO it should be looking for. -rpath is what tells it _where_ it should be looking for that SO
03:30:53FromDiscord<Girvo> What I've done in these situations, is basically make my nimble build task have an `before` block that copies the files needed to wherever nimble is going to put the binary
03:31:54*arkurious quit (Quit: Leaving)
03:32:28FromDiscord<Girvo> An example, is that I need `nimbase.h` in a particular place for my current project to be able to build. So I literally copy it from Nim before building
03:32:38FromDiscord<Girvo> sent a code paste, see https://paste.rs/9AW
03:33:53FromDiscord<Girvo> `binDir` being where the binary is going to go, IIRC. You can check for the existence of your `binDir / ".usr" / "lib"` directory, create it if it doesn't exist, and copy your SO files all in that `before build` block
03:34:55NimEventerNew thread by Mardiyah: How to do runtime constant in forward ?, see https://forum.nim-lang.org/t/9057
03:38:53FromDiscord<Girvo> Will nimble bring down some binary files if its a dependency of another project when `nimble install`-ed? And if so, where should they be put?
03:39:18nrds<Prestige99> Yeah I was hoping it could, but the nimble docs aren't super clear to me
03:39:36nrds<Prestige99> so maybe I should just write a custom solution like Elegantbeef was saying
03:40:54FromDiscord<Elegantbeef> It's what impbox did for nico and i did for the rpi pico stdlivb
03:40:54FromDiscord<Girvo> That's basically what I'd recommend 🙂 Even if it's as simple as a `Makefile` with some variables at the top, in a "template" project you ask your users to clone down. That will include the `.so` files in a known-good place, and allow you to ensure it's packaged correctly (with `rpath` set to where you now _know_ it will be)
03:41:12FromDiscord<Girvo> Its what I did for my SDL-on-macOS projects too back in the day
03:41:29FromDiscord<Elegantbeef> Actually girvo i could probably steal some help from you on the picostdlib 😛
03:41:45nrds<Prestige99> any docs on rpath?
03:41:46FromDiscord<Girvo> Hah I'd be glad to help 🙂
03:42:15FromDiscord<Girvo> Yep, one tick!
03:42:20FromDiscord<Girvo> https://en.wikipedia.org/wiki/Rpath
03:42:46FromDiscord<Girvo> https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html -- search for `-rpath dir`
03:43:20FromDiscord<Elegantbeef> The big thing I need to do is make is so no one has to manually add the libraries they're using to cmake, so I parse the C files then emit a list of the libraries that they're using, mostly just need to know the best way handling it @auxym and I have had a back and forth about it for a bit
03:43:29FromDiscord<Girvo> ^ that's not quite the current version, but rpath simply hasn't really changed in decades lol
03:43:59FromDiscord<demotomohiro> Latest binutils doc: https://sourceware.org/binutils/docs-2.38/ld/Options.html#Options
03:44:09FromDiscord<Girvo> Ah perfect! Read that one ^^^
03:44:12FromDiscord<demotomohiro> then grep `-rpath`
03:44:54FromDiscord<Girvo> @ElegantBeef Ooooh yeah thats an interesting problem! I have a couple of solutions to it. But a question for you: how cross platform does this need to be haha
03:45:27FromDiscord<Elegantbeef> I mean it needs to work for all OS that someone wants to develop for the rpi pico on
03:45:36FromDiscord<Girvo> Yeah fair enough 🙂
03:45:55*vicfred quit (Quit: Leaving)
03:46:06FromDiscord<Girvo> There are Linux-specific solutions, but they fall apart when cross-compiling from Windows (and macOS to a lesser extent)
03:46:27FromDiscord<Elegantbeef> I mean we have a build tool to do all the generating
03:46:41FromDiscord<Elegantbeef> I just havent really got to the best way of using the list i generate into cmake
03:47:19FromDiscord<Girvo> Is it up on github somewhere? I can take a look. You're basically trying to build the list to pass to `find_library` I assume?
03:47:47FromDiscord<Elegantbeef> Of course it is
03:48:18FromDiscord<Elegantbeef> https://github.com/beef331/picostdlib/blob/master/src/template/csource/CMakeLists.txt#L27
03:48:32FromDiscord<Elegantbeef> `pico_stdlib hardware_adc` are what the issue is presently
03:48:47FromDiscord<Elegantbeef> Right now you have to manually add the libraries you're using there
03:48:59FromDiscord<Girvo> Yeah, we have to do the same in ESP32 land
03:49:15FromDiscord<Elegantbeef> I have this PR right now which generates a list of the librariies https://github.com/beef331/picostdlib/blob/master/src/template/csource/CMakeLists.txt#L27
03:49:18FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3TKO
03:49:49FromDiscord<Girvo> Zephyr, I'm certain, has a nice solution for this. I'll have a look today and get back to you
03:50:08FromDiscord<demotomohiro> This document explains how linux search shared libraries at runtime: https://www.man7.org/linux/man-pages/man8/ld.so.8.html
03:51:06LuxuryModeIf I declare a variable of type `OptParser` using `let` and then try iterating over it, I get a strange error. Is this because the iterating requires mutating the `OptParser` itself or..? https://play.nim-lang.org/#ix=3TKP
03:51:40FromDiscord<Elegantbeef> `getOpt` takes a `var OptParser`
03:51:51FromDiscord<Girvo> His back-and-forward is right: if its autogenerating, instead of modifying the developers CMakeLists.txt, you create your own picostdlib-libraries.txt file that gets included into it... oh ignore me, you guys already went through all that lol
03:52:44FromDiscord<Elegantbeef> Just wanted to get your insight here, as you seemingly have more knowledge here
03:52:55LuxuryModeOh I see `iterator getopt(p: var OptParser): tuple[kind: CmdLineKind, key, val: string] {...}` I did not know a param could specify the type of binding required (not sure that's the right way to say that)
03:52:57FromDiscord<Girvo> Yeah I'm going through the PR 🙂
03:53:10LuxuryModeWhere can I find this explained in the docs?
03:53:14FromDiscord<Elegantbeef> My CMake knowledge is uhhh i walk past someone writting `cmake build`
03:53:21FromDiscord<Girvo> Hahaha
03:53:29FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#procedures-var-parameters
03:53:37LuxuryModeThanks very much
03:54:13FromDiscord<Elegantbeef> No problem
03:54:26FromDiscord<Girvo> HIs point about having piconim run `cmake ..` is the way to go IMO, if you've got a build tool wrapping/calling CMake anyway, it should run it. Now to check if there is a nicer way of handling this library list generation, one tick
03:54:41LuxuryModeIn Python, one can make a list from an iterator with `list(my_iterator)` Is there a way to accomplish the same thing in Nim?
03:54:55LuxuryModeOr just check if `item in iterator` kind of thing...
03:55:08FromDiscord<Elegantbeef> `import std/sequtils; let mtColl = toSSeq(myIter)`
03:55:14FromDiscord<Elegantbeef> `toSeq` even
03:55:19FromDiscord<Elegantbeef> My keyboard likes multi pressing
03:55:24LuxuryModeah very nice. Thank you!
03:55:45FromDiscord<Elegantbeef> Since you're doing parseopt i'm going to say you dont want that
03:56:31LuxuryModeYou mean I really just want to be iterating?
03:56:46FromDiscord<Elegantbeef> I'm assuming you're checking for specific flags?
03:57:08LuxuryModeright
03:57:26LuxuryModeMy goal is to be able to ignore all other flags if `--help` is supplied
03:57:27FromDiscord<Elegantbeef> Iterating over and using case statements is a much nicer idea imo
03:57:32LuxuryModeand in that case print the usage
03:57:59LuxuryModeor perhaps I want to just fail if any other flags are supplied together with `--help`. Not sure what the right approach is
03:59:59LuxuryModeThat makes sense. `case key of "help", "h": writeHelp()`
04:00:25FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3TKQ
04:00:43FromDiscord<Elegantbeef> You could even abuse the exception handler if you wanted, but that's odd
04:01:01LuxuryModeThanks, that's helpful
04:02:23FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3TKS for that try except method
04:02:29FromDiscord<Girvo> sent a long message, see http://ix.io/3TKT
04:02:56FromDiscord<Elegantbeef> I went through something similar to that girvo
04:03:08FromDiscord<Girvo> Yeah fair enough 🙂 I figured you must've haha
04:03:25FromDiscord<Elegantbeef> Actually i didnt use system vars
04:03:38FromDiscord<Elegantbeef> I manually wrote to a file using a ugly work around
04:03:53FromDiscord<Girvo> Ah I just though an env var isn't a bad fit, coz you can just use `ENV` in CMake then
04:04:24FromDiscord<Elegantbeef> The annoying part is that it means you have to manually annotate modules and forgetting is a silent issue since we have -10 test suites
04:04:30FromDiscord<Elegantbeef> Doesnt even know how you begin to test this API
04:04:51FromDiscord<Girvo> Hah, yeah testing in this space is... well, look, theres a reason most of this stuff in other languages also doesn't have tests 😉
04:05:56FromDiscord<Girvo> Anyway, I'll have a think and do some experimentation. Is there a particular CMake version you can require? Later versions have added a lot more stuff to help with this sort of thing
04:06:23FromDiscord<Elegantbeef> I'm using whatever the pico-sdk uses
04:06:56FromDiscord<Elegantbeef> Afterall my code is just wrapping their sdk dumbly and slowly, especially since I have practically nothing to toy with the pico with
04:07:32FromDiscord<Girvo> I have a pico around here somewhere. I can have a play with it, see what things are like
04:08:02FromDiscord<Girvo> But the long and the short is, most embedded cmake stuff requires you to add the libraries you want to your CMakeLists.txt somewhere lol
04:08:19FromDiscord<Elegantbeef> Yea but doing it manually sucks
04:09:11FromDiscord<Girvo> I don't disagree. Welcome to embedded 😄
04:09:13FromDiscord<Elegantbeef> The checking includes is imo the best solution given that it makes it so i can abstract the C code anyway i want
04:09:32FromDiscord<Girvo> Oh yeah, it's not a bad solution IMO, and if it works right now that's better than most.
04:09:53FromDiscord<Girvo> I'm looking at how Zephyr does it, and they do sort of the same thing, just in CMake scripting instead, from what I can see
04:09:55FromDiscord<Elegantbeef> Well it doesnt work presently since no one piped it together yet, i was waiting for casey's PR
04:09:58FromDiscord<Girvo> https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/linker/ld/target.cmake
04:10:35FromDiscord<Girvo> `LIBRARIES_PRE_SCRIPT` and `POST_SCRIPT` as well as `zephyr_link_libraries`
04:10:56FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3TKW
04:11:28FromDiscord<Elegantbeef> Mines more readable 😛
04:11:48FromDiscord<Girvo> CMake scripting is a god-damned dark art lol
04:12:10FromDiscord<Girvo> I feel like I'm summoning cthulu every time I do it
04:12:31FromDiscord<Elegantbeef> Yea i want to avoid it since it's just unmaintainable imo
04:13:07FromDiscord<Girvo> https://github.com/zephyrproject-rtos/zephyr/blob/main/cmake/linker/ld/ld_script.cmake
04:13:26FromDiscord<Elegantbeef> Did i stutter?
04:13:31FromDiscord<Girvo> This is basically the script they use to map symbol names to strings, then eventually to the target_link_library
04:13:38FromDiscord<Girvo> Haha nah I'm just curious how they do it 😉
04:14:40FromDiscord<Girvo> They're quite literally using regexes. Its near identical in terms of approach, though the way they do it is they compile it _without_ the libraries linked, search the binary for unlinked/not found symbols, then map them to the libraries they _do_ need to link
04:15:08FromDiscord<Elegantbeef> Ah ok so i'll be happy with mine
04:15:10FromDiscord<Girvo> So, yeah, stick with parsing `#include` 🙂
04:17:11FromDiscord<Girvo> I wonder if one could just link all the libraries, and then strip the unused symbols out lol
04:18:02FromDiscord<Girvo> Haha yeah, `-dead-strip` would technically do it
04:19:08FromDiscord<Girvo> Or `-fdata-sections -ffunction-sections` and link with `-Wl,--gc-sections` all in one command, with `-Os`. but that feels nearly as rube-goldberg machine like as your current solution 😂
04:20:21FromDiscord<Girvo> `-flto` also, though thats Clang, iirc.
04:20:26FromDiscord<Elegantbeef> How dare you say it's rube goldbergy
04:20:48FromDiscord<Girvo> Man any time I'm parsing C code, I want to curl up in a ball and cry 😉
04:21:00*Zectbumo quit (Quit: Zectbumo)
04:21:03FromDiscord<Elegantbeef> Hey scanf is easy
04:23:58*rockcavera quit (Remote host closed the connection)
04:25:24*Zectbumo joined #nim
04:26:42LuxuryModeAnything else I should have .gitignore aside from these? https://github.com/github/gitignore/blob/main/Nim.gitignore
04:35:05FromDiscord<Elegantbeef> binaries is another thing
04:36:52LuxuryMode*.out?
04:37:06FromDiscord<Elegantbeef> default on linux is no extension
04:37:20LuxuryModeah I see a .out after running nimble build on my Mac
04:37:33FromDiscord<congusbongus> I just add to the .gitignore as I go because I can't predict ahead of time what crazy files various IDEs/tools add↵also I check what I'm committing which is a concept that seems to escape a lot of my juniors /rant
04:37:41LuxuryModenim build doesn't do that though
04:37:50LuxuryModesorry, `nim c`
04:38:28FromDiscord<Elegantbeef> How dare you insult me congus, i often assume my ignore covers me and notice always 1 second too late so have to do a rebase to fix my fuckup!
04:38:40LuxuryModelel
04:39:17FromDiscord<congusbongus> I bet your commit messages are like "fixed thing"
04:39:30FromDiscord<Elegantbeef> Depends on what i'm working on
04:39:35LuxuryModegit commit -m "another commit"
04:39:38FromDiscord<Elegantbeef> If i'm working on a toy project yea
04:43:30FromDiscord<Girvo> Pfft. `git commit --amend` 😉
04:43:37FromDiscord<Girvo> Just do it all as one commit! mwahahaha
04:43:51FromDiscord<Elegantbeef> When you accidently already pushed
04:44:18FromDiscord<Girvo> Easy! `git push --force`
04:44:23FromDiscord<Girvo> Problem "solved" 😄
04:44:42*jmdaemon quit (Ping timeout: 272 seconds)
04:46:36*jmdaemon joined #nim
04:56:18*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
04:56:36*jmdaemon joined #nim
05:12:23FromDiscord<huantian> It’s fine if nobody else is looking to
05:22:10*slowButPresent quit (Quit: leaving)
06:14:49FromDiscord<Phil> In reply to @congusbongus "I just add to": Imagine having colleagues that make small commits of a small group of 3-4 with changes that relate to one another, instead of one massive commit of 30 files saying "added thing"
06:15:07FromDiscord<Phil> (edit) "In reply to @congusbongus "I just add to": Imagine having colleagues that make small commits of a small group of 3-4 ... with" added "files at most"
06:37:42FromDiscord<congusbongus> did you mean to reply to a different message?
06:59:31*ltriant quit (Ping timeout: 260 seconds)
07:25:00*ltriant joined #nim
07:32:07*neurocyte8 joined #nim
07:34:03*neurocyte quit (Ping timeout: 260 seconds)
07:34:04*neurocyte8 is now known as neurocyte
07:44:03*jmdaemon quit (Ping timeout: 260 seconds)
08:10:15*xet7 quit (Remote host closed the connection)
08:14:37*xet7 joined #nim
08:25:42*PMunch joined #nim
08:29:51*yoyojambo joined #nim
08:39:09*Zectbumo quit (Remote host closed the connection)
08:48:04*yiggityswaps joined #nim
08:49:53*yoyojambo quit (Ping timeout: 252 seconds)
09:09:45*yiggityswaps quit (Quit: Leaving)
09:10:00*yiggityswaps joined #nim
09:16:26PMunchI love how this simple topic just turned into a list of good ways to learn programming: https://forum.nim-lang.org/t/9053
09:36:47FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3TLP
09:36:56FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3TLQ
09:36:56FromDiscord<tandy> this is the code it generates
09:37:23FromDiscord<tandy> sent a code paste, see https://paste.rs/18i
09:37:32*yiggityswaps quit (Read error: Connection reset by peer)
09:37:48FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3TLR
09:40:07*xet7 quit (Quit: Leaving)
09:40:46*gsalazar_ joined #nim
09:41:37FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=3TLU
09:43:16*gsalazar quit (Ping timeout: 246 seconds)
09:47:27FromDiscord<untoreh> can you make a generic accessor over an object variant?
09:49:36*gsalazar_ quit (Quit: Leaving)
09:49:45*gsalazar joined #nim
09:50:14FromDiscord<untoreh> sent a code paste, see https://play.nim-lang.org/#ix=3TLW
09:54:54FromDiscord<Solitude> no, you cant
09:58:56FromDiscord<TryAngle> In reply to @Girvo "I feel like I'm": I've no clue tbh. but I've heard Zig toolchain can replace all that stuff 🤔 ↵is that true?
10:36:57FromDiscord<Rika> In reply to @untoreh "something like this doesnt": Generics have to resolve to one type at compile time. An accessor like this is dependent on run time values to determine the return type
11:10:16FromDiscord<Phil> In reply to @congusbongus "did you mean to": No, it was just early in the morning before proper waking time and I fucked up sentence structure in english.↵Was more meaning to say that while you struggle with folks unable to use gitignore, I struggle with folks unable to make small commits which makes understanding their code based on the steps they took a massive pain in my butt.
11:13:41FromDiscord<Zoom> This is what forums are. The recurring plot is\: 5 posts to understand what the issue is, 10 posts to ask "Why do you need to solve this? Solve this instead!", 5 posts with solutions, mostly wrong, 50 posts discussing how the working solution was wrong, 5000 posts discussing how we all live in a simulation↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
11:15:57PMunchHaha :P
11:16:10PMunchSounds about right
11:17:06FromDiscord<Zoom> Anyone packaged Nim stuff for Debian? I'm looking at their [guide](https://www.debian.org/doc/manuals/debmake-doc/index.en.html)'s ToC and my head starts spinning
11:17:50*ehmry quit (Ping timeout: 252 seconds)
11:18:59PMunch@Zoom, once you've mastered all these packaging guidelines it would be extremely helpful if you could write a small guide on how to package Nim applications for Linux :)
11:19:49FromDiscord<fbpyr> [Zoom](https://matrix.to/#/@Zoom:matrix.org)\: on my debian machines I just pulled the pre-built linux binaries\: https://nim-lang.org/install_unix.html
11:19:53PMunchJust had a look at that guide, 8 chapters :S
11:20:04FromDiscord<Zoom> Please, God, no \:O↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
11:20:18PMunchWhere the basics chapter is split into 27 subchapters
11:22:57*ehmry joined #nim
11:42:42*jjido joined #nim
11:44:38FromDiscord<auxym> In reply to @Elegantbeef "Hey scanf is easy": Been reading you and @Girvo's conversation (I was asleep, you guys must be on the west coast). interesting stuff. Another random idea, sorta similar to parsing `#include`s: maybe we could `exportc` a special, dummy token from each picostdlib library? like a dummy proc PICOSTDLIB_INCLUDE_TIME or whatever and then scan for that in the generated C? if it's a a no-op proc then impact on code size
11:48:19PMunchHmm, I wonder if Futhark would handle Pico headers
12:07:37*slowButPresent joined #nim
12:20:23*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
12:54:05FromDiscord<hmmm> friendsies, what is the best way to make a field object to store some flags and objects? I'm currently using a seq and reading if the flag is there but sounds dumb. I think I've seen people using bitfiddling bitmasks bitvoodoo and wondering if it makes sense for me 🤔
12:54:27FromDiscord<Rika> Flags are usually represented as sets in Nim
12:54:36FromDiscord<hmmm> really?
12:54:40FromDiscord<hmmm> had no idea
12:54:53FromDiscord<Rika> Yes because most people don’t use it and do it the C way
12:55:00FromDiscord<hmmm> do you have some examples of people using them for flags in the wild?
12:55:06FromDiscord<Rika> Uh
12:55:15FromDiscord<Rika> Nothing really comes to mind
12:56:22FromDiscord<hmmm> hmm I'll just fiddle a bit with sets and see if they make sense for my case, thanks rika 💯
12:59:54FromDiscord<auxym> In reply to @PMunch "Hmm, I wonder if": if you want a challenge try tinyusb 🙂
13:00:25FromDiscord<auxym> our issue with pico atm isn't so much the headers as wrapping / automating the pico sdk's cmake based build
13:05:26FromDiscord<auxym> @hmmm https://nim-lang.org/docs/manual.html#set-type-bit-fields
13:06:00FromDiscord<auxym> we use them a lot in picostdlib, I can point you to some examples if you want
13:06:22PMunch@auxym, the problem with these libraries is (at least the AVR stuff) that they require a special compiler
13:06:30PMunchSo the clang-based parsing doesn't work
13:06:44PMunchAs long as you can build them with a "normal" compiler then it should work just fine
13:06:47FromDiscord<auxym> you mean tinyusb? or cmake?
13:07:56FromDiscord<auxym> the challenge with tinyusb is macros. for example, the generation of usb descriptors is implemented 100% through a whole lot of macros
13:09:06FromDiscord<Rika> Hand conversion time
13:14:45FromDiscord<auxym> beef and I gave up, haha. someday maybe. Right now I'm just calling them from a C file that I also include in the build.
13:20:02*Gustavo6046 quit (Ping timeout: 260 seconds)
13:21:21*rockcavera joined #nim
13:21:21*rockcavera quit (Changing host)
13:21:21*rockcavera joined #nim
13:24:30FromDiscord<hmmm> In reply to @auxym "<@!887269570765791243> https://nim-lang.org/docs/m": thanks auxy, I wanted an example just to make sure I was reading them correctly even if I guess there is not much science to it lol
13:25:02FromDiscord<hmmm> also why do you use bitfields instead of sets?
13:25:30FromDiscord<hmmm> oh they ARE sets lol
13:25:36FromDiscord<Rika> was gonna say
13:25:56FromDiscord<Rika> a (non-hash) set is a bitfield (only in implementation, though its doubtful it will change)
13:28:13*Gustavo6046 joined #nim
13:28:54FromDiscord<auxym> In reply to @hmmm "thanks auxy, I wanted": here's an example, there are others in the same file. it's fully compatible with the c struct that is imported, too. https://github.com/beef331/picostdlib/blob/master/src/picostdlib/tusb.nim#L317
13:29:45*Gustavo6046 quit (Max SendQ exceeded)
13:30:24*Gustavo6046 joined #nim
13:36:42*yoyojambo joined #nim
13:44:42*yoyojambo quit (Read error: Connection reset by peer)
13:44:58PMunchAh C macros are a PITA
13:50:04FromDiscord<Phil> Under which circumstances does -d:Danger actually become a bad choice to use?↵Or other way around if it's easier, under which circumstances does it become a good choice to use (assuming it breaks something must of the time unless specific circumstances X)?↵Mostly asking because I have no idea of the implications that come with "turn off runtime checks and turn on optimizer"
13:51:36FromDiscord<auxym> IMO: only use Danger for high-performance numerical code, or maybe embedded. Otherwise the cost of runtime checks is pretty cheap compared to the advantages of not having silent overflow bugs
13:52:34FromDiscord<auxym> -d:release does optimization and keeps the runtime checks, fyi
13:53:57FromDiscord<auxym> there's more info on runtime checks here: https://nim-lang.org/docs/manual.html#pragmas-compilation-option-pragmas danger turns all of that off
13:59:02FromDiscord<Solitude> In reply to @Isofruit "Under which circumstances does": always -d:danger, fuck it. if you need checks, you deserve to crash.
14:01:21*arkurious joined #nim
14:03:21FromDiscord<auxym> well, the whole point of checks is causing crashes instead of silently doing bad stuff (integer overflow, accessing memory outside an array...)
14:04:27FromDiscord<Solitude> yeah, whatever, also put --panics:on in your global nim.cfg
14:07:12FromDiscord<tandy> when you want good jsgen \:)↵(@Phil)
14:07:27FromDiscord<tandy> \dont
14:08:33*lumo_e joined #nim
14:20:14FromDiscord<Phil> ... Looking through the compiler docs, I don't know why nim supports Nintendo switch cross complain, but I am amused that it does
14:20:32FromDiscord<Phil> (edit) "complain," => "compilation,"
14:21:51FromDiscord<ajusa> what's the correct alternative for using a Table[string, string] on the JS backend?
14:22:39FromDiscord<ajusa> In reply to @Isofruit "... Looking through the": I've gotten it working on the 3DS as well, and exelotl runs Nim on the GBA
14:34:14*lumo_e quit (Remote host closed the connection)
14:41:56FromDiscord<ajusa> In reply to @ajusa "what's the correct alternative": JsAssoc appears to be the correct thing to use
14:48:02*lumo_e joined #nim
14:48:54FromDiscord<demotomohiro> In reply to @Isofruit "... Looking through the": It seems this is first PR adds Nintendo switch support to Nim: https://github.com/nim-lang/Nim/pull/8069
14:52:14*anddam left #nim (WeeChat 3.4.1)
14:53:55*Gustavo6046 quit (Quit: I'm a quit message virus. Please replace your old line with this line and help me take over the world. <screw you aloo_shu my old line was better and more creative!>)
15:16:24*perro joined #nim
15:28:20FromDiscord<leorize> federico3 is our resident Debian maintainer
15:29:35*Gustavo6046 joined #nim
15:30:46*Gustavo6046 quit (Remote host closed the connection)
15:31:06*Gustavo6046 joined #nim
15:45:42*LuxuryMode quit (Quit: Connection closed for inactivity)
15:59:52*Gustavo6046 quit (Ping timeout: 260 seconds)
16:26:22*jmdaemon joined #nim
16:29:10*vicecea quit (Remote host closed the connection)
16:29:38*vicecea joined #nim
16:32:44FromDiscord<kevin> Is there a way to convert/parse a byte string into a nim array?
16:32:56FromDiscord<kevin> `let key: array[32, byte] = "FFFFFFFF00000000FFFFFFFF00000000".parseHexStr()`
16:33:05FromDiscord<kevin> (edit) "key:" => "test:"
16:33:13FromDiscord<kevin> something like this?
16:34:32FromDiscord<kevin> `got 'string' for 'parseHexStr but expected array[0..31 byte]`
16:35:07FromDiscord<kevin> Is this kind of conversion even possible? I know arrays have some runtime limitations
16:37:56FromDiscord<qb> Is cross compiling with clang doable?
16:40:14*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
16:42:03*Lord_Nightmare joined #nim
16:42:24FromDiscord<Generic> theoretically yes
16:42:30FromDiscord<Generic> though I personally never got it working
16:43:13FromDiscord<Generic> a single clang build can target multiple systems
16:44:22FromDiscord<Generic> but that's already where it can get hard, because lots of distributions of clang are only compiled with support for compiling whatever is native
16:45:26FromDiscord<Generic> if you get over this hurdle, you need to figure out how to get the standard library into this mix
16:46:15FromDiscord<qb> Okay so I better boot up the windows vm and compile with clang directly ;D
16:46:34FromDiscord<Generic> ah you're not talking about embedded
16:47:37FromDiscord<Generic> idk about that, I've heard that cross compiling for windows with gcc and mingw works relatively well
16:48:25FromDiscord<Generic> but I never tried it myself
17:00:39rockcaverakevin, yes, it's possible
17:02:38FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3TNw
17:02:47FromDiscord<kevin> so close lol but I'm missing something
17:06:21FromDiscord<kevin> maybe I don't actually need an `array[32, byte]` ? Maybe just use the openarray where functions require a `array[32, byte]`?
17:07:05Amun-Rakevin: does it have to be an array?
17:07:32FromDiscord<kevin> My functions all take parameters of `array[32, byte]`
17:07:35FromDiscord<huantian> I think you might want a cast? Or just uh manually convert the string into chars and bytes?
17:07:52FromDiscord<huantian> I don’t know if you can just cast a string to a byte array
17:12:19Amun-Rakevin: https://play.nim-lang.org/#ix=3TNy
17:13:37FromDiscord<kevin> actual magic
17:13:47FromDiscord<kevin> thanks! ❤️
17:22:47*vicfred joined #nim
17:47:29*LuxuryMode joined #nim
18:02:37*Zectbumo joined #nim
18:15:35FromDiscord<Phil> sent a long message, see http://ix.io/3TNT
18:17:50FromDiscord<Solitude> In reply to @Isofruit "Reading through it, though": ~~if you can write manual parser in under 5 minutes for that regex - you are misusing regex.~~ fuck regex
18:17:53PMunch@Phil well you could go through the string character by character manually
18:18:33FromDiscord<Phil> ... that sounds so painful I'd rather deal with regexes
18:19:00PMunchAnd if you haven't programmed a lot then the complexity of Regex on top of the complexity of learning to program could be tricky
18:20:10FromDiscord<Phil> I mean, maybe I'm predisposed since in Bioinformatics 50% what you write is regexes since the vast majority of time you're looking for patterns of amino-acid/nucleotide-chains (which programmatically speaking are just a single string a chain), so I'm very used to them, but man
18:20:20FromDiscord<Phil> In reply to @PMunch "And if you haven't": Okay, fair, mixes with Araqs language in a language thing
18:20:49FromDiscord<Phil> (edit) "a" => "per"
18:20:51PMunchExactly
18:21:18PMunchI mean if you're learning Nim coming from a different language and already know Regexes then use them as you would elsewhere (which should already be sparingly)
18:23:23FromDiscord<auxym> I think araq was trying to make the point: don't use strings to store data (in-memory) that could be stored in a properly typed object/struct
18:23:45FromDiscord<auxym> via an adhoc serialization protocol using regexes...
18:25:06FromDiscord<auxym> I'm not sure that a college-level Algorithms textbook is exactly the right place to start for someone who's never, ever programmed, but heh, everyone learns differently I guess.
18:26:28FromDiscord<Phil> Hmmm I might actually want to play around with that distinct string thing
18:27:02FromDiscord<Phil> I do have stuff like "campaignName", "articleName" which could be used as distinct strings I guess
18:27:15FromDiscord<Phil> So far I only went around eliminating strings through enums when possible
18:45:49*tiorock joined #nim
18:45:50*tiorock quit (Changing host)
18:45:50*tiorock joined #nim
18:45:50*rockcavera is now known as Guest4465
18:45:50*Guest4465 quit (Killed (calcium.libera.chat (Nickname regained by services)))
18:45:50*tiorock is now known as rockcavera
18:46:55*tiorock joined #nim
18:46:56*tiorock quit (Changing host)
18:46:56*tiorock joined #nim
18:46:56*rockcavera is now known as Guest1762
18:46:56*tiorock is now known as rockcavera
18:50:43*Guest1762 quit (Ping timeout: 260 seconds)
18:52:57*tiorock joined #nim
18:52:57*tiorock quit (Changing host)
18:52:57*tiorock joined #nim
18:52:58*rockcavera quit (Killed (copper.libera.chat (Nickname regained by services)))
18:52:58*tiorock is now known as rockcavera
19:03:18FromDiscord<hmmm> broskis are emojis universal like ascii in the sense that I can count on them to be displayed regardless of whatever contraption the user is bogged with?
19:11:36FromDiscord<hmmm> oh they are unicode
19:12:04FromDiscord<hmmm> but a common kind of unicode right? 🤔
19:16:30PMunchCertainly more common than hieroglyphs or cuneiform
19:16:44PMunchBut certainly not as ubiquitous as ASCII
19:17:05FromDiscord<hmmm> hmm that's what I thought, but I guess good enough is good enough
19:17:10PMunchAnd of course with the normal caveat that glyphs can we drawn differently between platforms
19:17:15FromDiscord<hmmm> they get displayed like garbage on ascii only systems?
19:17:17PMunchWhat are you doing with them?
19:17:24PMunchPretty much
19:17:44PMunchEver seen those Ãẗ things in the middle of a word?
19:17:59FromDiscord<hmmm> I need to make some elements in my app visible and don't want to make them with something like () lol
19:18:00PMunchThose are probably characters that don't render properly because of encoding issues
19:18:12PMunchTerminal app?
19:18:19FromDiscord<hmmm> yea I've seen them
19:18:21FromDiscord<hmmm> no gui app
19:18:39*Gustavo6046 joined #nim
19:18:44PMunchAh, then it's probably just up to the renderer
19:19:23FromDiscord<hmmm> pmunchie since you are here listen to this other question, today we looked into sets and bitfield, but
19:19:45*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
19:19:47FromDiscord<hmmm> what happens if I define an enum for my field with ABC and then I want to add function D?
19:19:51*Gustavo6046 quit (Remote host closed the connection)
19:20:11FromDiscord<hmmm> aren't strings more flexible for people that don't know how much more functionality they want to add?
19:20:14*Gustavo6046 joined #nim
19:20:34FromDiscord<auxym> emojis are utf8, which is slowling becoming the standard, but they're a bit special and not even all systems that support utf8 support emojis
19:20:43PMunch@hmmm, then you need to add another field to your enum
19:20:49PMunchI'm not sure what the question is
19:21:12FromDiscord<hmmm> hmm the things are getting committed to disk I don't know if I can change the enum on the fly
19:21:55PMunchUhm, not quite sure what you're doing here
19:21:56FromDiscord<hmmm> the context is using sets / enum for flags lol I didn't tell
19:22:04*jmdaemon joined #nim
19:22:19FromDiscord<hmmm> hmm I'll thing about it some more
19:22:30FromDiscord<auxym> yeah but what's the story about dynamically changing your enum defs, that sounds a bit weird
19:23:02PMunchWhen serialising an enum to a file it will just get turned into an int
19:23:05PMunchSame for bit sets
19:23:50PMunchSo if you extend the enum (as long as it doesn't require more bytes than the previous definition, this can be controlled in Nim) a new reader will be able to read an older file just fine
19:23:57FromDiscord<hmmm> no wait what I really want to say is that if I have an enum that is north south east ovest I can't add up later right?
19:24:02PMunchAs long as you keep all the enum values the same of course
19:24:16PMunch@hmmm, sure you can
19:24:21FromDiscord<hmmm> oh rly?
19:24:27FromDiscord<hmmm> I'm totally amazed lol
19:24:30FromDiscord<Solitude> whos gonna stop you
19:24:41PMunchI mean you can't do it dynamically while your program is running
19:24:55FromDiscord<auxym> add what? a new enum entry, or a new flag in the set? And when? At run time or in a subsequent build or something?
19:24:56PMunchBut if you recompile your program you can do whatever you want :P
19:25:55FromDiscord<hmmm> hmm excuse me I'll go dabbling some tests on enums I was half convinced you couln't change them lol
19:28:12*neurocyte8 joined #nim
19:28:59*neurocyte quit (Ping timeout: 260 seconds)
19:33:54FromDiscord<auxym> I think we may be misunderstanding your question. It's a program. A text file. You can wipe it all out, rewrite it and recompile any time you want.
19:36:49FromDiscord<hmmm> hmm ok you can't change them dynamically
19:36:54FromDiscord<hmmm> unless I'm missing something lol
19:37:15FromDiscord<Rika> No you can’t but you can change it before compilation
19:37:27FromDiscord<hmmm> ye that was apparent to me even before lol
19:37:36FromDiscord<Rika> I don’t understand what you’re asking
19:37:39FromDiscord<Rika> Most of us don’t
19:38:29FromDiscord<hmmm> so if I choose an enum scheme I can add new enums but can't remove them without breaking the app for existing users
19:38:54FromDiscord<hmmm> hmm that's fine
19:38:55FromDiscord<Rika> Well yeah just like removing field
19:39:18FromDiscord<Rika> The way to remove fields or enums is to mark them deprecated
19:39:38FromDiscord<Rika> Or
19:39:56FromDiscord<Rika> When deserialising an old object, map it to the new object
19:40:02FromDiscord<Rika> And save only new objects
19:40:15FromDiscord<hmmm> that's kinda genius tbh
19:42:40FromDiscord<Rika> So your project still has the old objects named “ObjectV1” v2 etc and the new one is just called “Object”
19:43:08FromDiscord<Rika> OR
19:43:12FromDiscord<Rika> Your object has a version field
19:43:32FromDiscord<auxym> In reply to @hmmm "hmm ok you can't": you can't change the enum typedef dynamically, but you can add / remove entries (flags) from your set any time
19:43:44FromDiscord<Rika> So you just need to load that field and check what it is, then your proc can use whatever logic (chosen by case statement) to load into the new object
19:43:54FromDiscord<hmmm> actually I'm having this problem right now since I'm adding options and will break all my pre existing data but I think I don't want to write stuff just map it back, I guess I will do it the caveman way lol
19:44:36FromDiscord<Rika> In reply to @Rika "So you just need": This is kinda a database design thing by the way, migration based versioning
19:45:16FromDiscord<hmmm> yea it's for things that matter I guess 😛
19:45:27FromDiscord<auxym> deech has some cool ideas about using macros to upgrade between different generations of your types in this talk: https://thestrangeloop.com/2021/nim-nuggets-systems-programming-and-metaprogramming-magic.html
20:08:14FromDiscord<Elegantbeef> It's a cool idea but i dislike that we have types with versioned names
20:10:40FromDiscord<Bubblie> So for a linux executeable, how do I make on in nim? I know regular linux executeables have .elf, but Iirc it can be any format and linux can execute it.
20:10:54FromDiscord<Bubblie> (edit) "on in" => "one from"
20:10:57FromDiscord<Rika> ? Just compile?
20:11:17FromDiscord<Elegantbeef> Linux doesnt have an executable extension
20:11:32FromDiscord<Rika> Linux doesn’t use extensions technically
20:11:39FromDiscord<Elegantbeef> Linux doesnt use file extension for dispatch it uses it only as a hint for programs
20:11:56FromDiscord<Rika> If it’s marked executable, Linux will try to execute it
20:12:08FromDiscord<Bubblie> Since im on windows it makes an exe, so is there something I can do to make a executeable for linux from windows?
20:12:22FromDiscord<Rika> There are many Python or other script languages marked as executable and are because of shebang comments or whatever they’re called
20:12:31FromDiscord<Rika> In reply to @Bubblie "Since im on windows": Okay so cross compile?
20:12:56FromDiscord<Bubblie> Is there any docs on cross compilation?
20:13:15FromDiscord<Bubblie> For nim
20:13:31FromDiscord<Elegantbeef> No we thought you wanted rust cross compilation docs 😜
20:13:36FromDiscord<Bubblie> LMAO
20:13:37FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#crossminuscompilation
20:13:43FromDiscord<Bubblie> Thanks beef
20:26:21NimEventerNew thread by Markus_gritsch: Automatic dereferencing for procs, see https://forum.nim-lang.org/t/9058
20:46:40FromDiscord<Zoom> Wait, we have no ability to kill threads in stdlib? How else can I stop a thread hung up on a blocking IO?
20:47:48FromDiscord<Rika> Not cross platform probably
20:48:01FromDiscord<Rika> Otherwise you might be able to use kill in p thread
20:49:00FromDiscord<tandy> how does one wrap an async js function ?
20:49:47FromDiscord<Zoom> That sucks, because I relied on OS to clean up threads after quit(0) but Bash, of all places, gets unresponsive due to one of the threads having blocking `getch()`
20:50:14FromDiscord<Zoom> I don't really get why the terminal is affected after the program quits
20:51:46FromDiscord<Zoom> I'm trying to fix this whole mess of threads and not require the user to hit "any key" to release the thread
20:53:01FromDiscord<Elegantbeef> Seems like the best thing would be to have a custom exit hook which wraps the windows/unix thread close APIs
20:53:13FromDiscord<Elegantbeef> Or a PR to add that functionality to threads, it's odd it doesnt have it
20:53:14FromDiscord<Zoom> We have `destroyThread` in std/threads... under `when false:` 😠
21:04:44FromDiscord<Zoom> Anyone has any idea why terminal with bash gets borked in my case? Again, currently I'm not joinning threads, not calling sync or anything, just `quit(0)`. On of the threads is caught blocked waiting for user input. Everything works fine for me with Fish, but with Bash the terminal gets unresponsive, even though the program finishes fine, no zombie threads in sight.
21:07:06FromDiscord<Elegantbeef> This is related to your not tetris eh?
21:07:06FromDiscord<Zoom> Yep
21:07:33FromDiscord<Elegantbeef> No clue how helpful i'll be but after i'm done documenting micros procedures i'll take a look
21:09:02FromDiscord<Zoom> Someone reported a bug and I think this is the cause, I'm not really knowledgeable enough in all things terminal so this is a bit baffling.
21:14:14FromDiscord<auxym> doesn't look like nim has daemon threads like in java/python either. in those langs daemon threads always get killed when their parent (ie your main thread) exits
21:18:45PMunchThat honestly sounds like a bash bug tbh
21:18:51PMunchIf there are no zombie processes left
21:19:13PMunchBut oh well, I'm off to bed
21:19:14*PMunch quit (Quit: leaving)
21:19:26FromDiscord<Elegantbeef> Buh bye
21:21:14FromDiscord<Zoom> Yeah, [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org) you don't need to torture yourselve and read my code, I've condensed the source of the bug
21:25:40FromDiscord<Zoom> https://play.nim-lang.org/#ix=3TOu
21:42:55*wyrd quit (Ping timeout: 240 seconds)
21:46:50FromDiscord<Elegantbeef> It seems like it's an issue with the program closing without resetting the stdout attributes
21:50:07*wyrd joined #nim
21:52:08FromDiscord<Elegantbeef> [Zoom](https://matrix.to/#/@Zoom:matrix.org)\: it's not ideal but https://play.nim-lang.org/#ix=3TOA
21:53:01FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/terminal.nim#L805-L806 we finish what the system couldnt 😛
21:55:04*Jjp137 quit (Quit: Leaving)
22:03:35*mn3m0n1c joined #nim
22:22:43*vicfred quit (Quit: Leaving)
22:27:16*LuxuryMode quit (Quit: Connection closed for inactivity)
22:37:54FromDiscord<Zoom> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: thanks a lot. That's some ugly boilerplate code though, gotta hide it \:)
22:38:12FromDiscord<Zoom> Interesting, that the issue isn't present on Fish
22:38:54FromDiscord<Elegantbeef> Might be that fish resets the stdout after the program closes, whereas bash doesnt. I dont know
22:40:04FromDiscord<Elegantbeef> Even piping with bash causes the issue, so clearly it's a permanent change to the file
23:08:39*Zectbumo quit (Remote host closed the connection)
23:11:46*yoyojambo joined #nim