<< 12-01-2022 >>

00:03:31*noeontheend joined #nim
00:09:54NimEventerNew thread by Sixte: Module typing, code reuse and separate compilation , see https://forum.nim-lang.org/t/8795
00:13:46*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
00:14:13FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LW1
00:16:23FromDiscord<Elegantbeef> No
00:16:45FromDiscord<Elegantbeef> `proc `[]=`[T: not NiPref](node: var PrefsNode, key: string, val: T) = `
00:17:34FromDiscord<Elegantbeef> Replace `NiPref` for whatever the second type is
00:18:13FromDiscord<Patitotective> the second type?
00:19:10FromDiscord<Patitotective> do you mean `PrefsNode`? or the table type, which is `PObject`?
00:19:22FromDiscord<Patitotective> (edit) "`PObject`?" => "`OrderedTable[string, PrefsNode]`?"
00:23:31FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LW4
00:23:37FromDiscord<Elegantbeef> What ever the value is for the table
00:23:37FromDiscord<Elegantbeef> You have `Table[K,V]` that should be `T: not V` with whatever your V is
00:24:02FromDiscord<Patitotective> why?
00:32:18*covoid19 quit (Quit: Client closed)
00:32:24FromDiscord<Elegantbeef> why what?
00:33:04FromDiscord<Patitotective> why `T: not V`?
00:33:41FromDiscord<Elegantbeef> Cause you dont want to call this proc when `T is V` you want to call the `table[K] = V`
00:33:59FromDiscord<Elegantbeef> If you remove that it'll always dispatch on this and have stack overflows
00:34:12FromDiscord<Elegantbeef> Since `node.objectV[key] = newPNode(val)` matches the procedure call
00:35:02FromDiscord<Patitotective> sent a code paste, see https://paste.rs/6J6
00:36:08FromDiscord<Elegantbeef> i mean i dont know why it doesnt i dont know what any of this is
00:36:12FromDiscord<Elegantbeef> A compiler error or output would be nice
00:37:30FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LWb
00:37:49FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3LWb" => "https://play.nim-lang.org/#ix=3LWc"
00:37:59FromDiscord<Elegantbeef> I mean the compiler error says why
00:38:20FromDiscord<Elegantbeef> `but expression 'val' is of type: PrefsNode`
00:39:09FromDiscord<Patitotective> so i must do `newPNode` for every element in a sequence?
00:39:21FromDiscord<Patitotective> (edit) "so ... i" added "should" | removed "must"
00:40:30FromDiscord<Patitotective> nvm
00:40:34FromDiscord<Elegantbeef> Well `proc newPNode(obj: PSeqParam): PrefsNode` you need a `PSeqParam`
00:40:37FromDiscord<Elegantbeef> Whatever that is
01:21:25*noeontheend quit (Ping timeout: 240 seconds)
01:31:03*krux02 quit (Remote host closed the connection)
01:48:48FromDiscord<Patitotective> How can I make a type that's just a shortcut for another type?↵https://play.nim-lang.org/#ix=3LWp
01:49:00FromDiscord<Elegantbeef> You didi
01:49:06FromDiscord<Patitotective> But it doesn't work
01:49:10FromDiscord<Patitotective> (edit) "work" => "work, run it"
01:49:37FromDiscord<Elegantbeef> Read the erroor
01:49:39FromDiscord<Elegantbeef> error even
01:49:55FromDiscord<Elegantbeef> `expected var`
01:50:13FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/4qN
01:50:36FromDiscord<Patitotective> In reply to @Elegantbeef "Read the erroor": sorry... hehe ;-;
01:55:24FromDiscord<Patitotective> sent a code paste, see https://paste.rs/Vtt
01:55:42FromDiscord<Elegantbeef> Typically
01:55:47FromDiscord<Elegantbeef> Unless it's a reference
01:56:25FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LWs
01:56:33FromDiscord<Patitotective> (edit) "https://play.nim-lang.org/#ix=3LWs" => "https://play.nim-lang.org/#ix=3LWt"
01:56:56FromDiscord<Patitotective> What happens when it is a reference?
01:57:22FromDiscord<Elegantbeef> An immutable reference's fields are mutable
01:57:30FromDiscord<Elegantbeef> So `var` is only required to change where the reference points
02:04:58FromDiscord<huantian> sent a code paste, see https://paste.rs/4gX
02:06:45FromDiscord<huantian> XQueryTree takes `para1: PDisplay, para2: Window, para3: PWindow, para4: PWindow, para5: PPWindow, para6: Pcuint`
02:07:07FromDiscord<Elegantbeef> Making a window manager?
02:07:09FromDiscord<Rika> What is wrong?
02:07:38FromDiscord<huantian> wups forgot a line
02:07:46FromDiscord<Rika> Lol
02:07:47nrds<Prestige99> must be, beef
02:07:53FromDiscord<Elegantbeef> https://github.com/beef331/goodwm/blob/master/src/goodwm.nim#L47-L55 is how you should do it
02:08:12FromDiscord<huantian> but the for loop segfaults on the second iteration
02:09:49FromDiscord<Elegantbeef> Why are you creating a cuint
02:10:00FromDiscord<Elegantbeef> just do `n = 0.cuint`
02:10:05FromDiscord<Elegantbeef> then pass `n.addr`
02:10:31FromDiscord<huantian> oh I can do that? that is helpful
02:11:43FromDiscord<Elegantbeef> Also you should use XCreate to interact with Xlib
02:13:31FromDiscord<huantian> trying to get the window of an already existing window though
02:14:29*Gustavo6046 joined #nim
02:15:21FromDiscord<Elegantbeef> Anyway everthing else looks good
02:16:26FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=3LWC
02:16:29FromDiscord<huantian> then segfaults
02:16:55FromDiscord<huantian> I think I'm doing something incorrect with children/childrens?
02:17:39FromDiscord<huantian> (edit) "https://play.nim-lang.org/#ix=3LWC" => "https://paste.rs/Sc3"
02:19:15FromDiscord<congusbongus> do you need to check the return value of XQueryTree
02:19:17FromDiscord<Elegantbeef> It seems right to me but i've been known to read bad
02:19:40FromDiscord<Elegantbeef> It returns an error code so they should
02:21:23FromDiscord<huantian> hm yeah it returns 1
02:22:23FromDiscord<huantian> why is it failing
02:23:35FromDiscord<huantian> wait no nonzero is success
02:27:02FromDiscord<huantian> so that isn't failing
02:27:30*neurocyte09170 joined #nim
02:29:44*neurocyte0917 quit (Ping timeout: 256 seconds)
02:29:44*neurocyte09170 is now known as neurocyte0917
02:41:17FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWD
02:41:26FromDiscord<Elegantbeef> Avoiding "X is not used"
02:41:37FromDiscord<auxym> oh
02:41:38FromDiscord<Rika> just doing nothing pretty much
02:41:40FromDiscord<auxym> so nothing
02:41:42FromDiscord<auxym> yeah
02:41:44FromDiscord<auxym> thanks
02:41:47FromDiscord<Elegantbeef> As you can tell it's "not implemented"
02:41:52FromDiscord<auxym> heh
02:57:25FromDiscord<auxym> btw @ElegantBeef, what do you think of my proposal to write all the target_link_libraries stuff in a separate include file for your picostdlib PR?
02:58:00FromDiscord<Elegantbeef> Seems fine, i'm still disliking the method of writing the linked libraries though
02:58:04FromDiscord<Elegantbeef> I really dislike the hack
02:58:56FromDiscord<Elegantbeef> I dont know if you looked at the hack but it's a hack
02:59:20FromDiscord<Elegantbeef> https://github.com/beef331/picostdlib/blob/683445f825b1ff538133f0aec840f8eafc72dfa6/src/picostdlib/private/linkutils.nim makes me hurt inside
02:59:24*vicfred quit (Quit: Leaving)
02:59:29FromDiscord<auxym> I don't mind the "write some nim code and invoke nim" thing, personally.
02:59:45FromDiscord<auxym> not a huge fan of "importing this library writes to a file"
03:00:09FromDiscord<Elegantbeef> I mean we need to propagate to the builder somehow
03:00:15FromDiscord<Elegantbeef> I'm still lost at the best way to do that
03:00:20FromDiscord<Elegantbeef> I dont like the searching for headers
03:00:28FromDiscord<auxym> not sure if there's a better way. Why not scan the nim compiler C files though?
03:00:30FromDiscord<Elegantbeef> It's probably the least hacky
03:00:59FromDiscord<auxym> yeah, choice between a hack and a hack 🙂
03:01:09FromDiscord<Elegantbeef> Cause you can import multiple different ways
03:01:35FromDiscord<auxym> how so?
03:01:42FromDiscord<Elegantbeef> `from x import y` `import x as y` `import x except y`
03:01:55FromDiscord<Elegantbeef> What do you mean?
03:03:57FromDiscord<auxym> that shouldn't break either method of detecting the import, no? You get the module output as a c file. Or the import writes to the file
03:04:30FromDiscord<Elegantbeef> Oh i misread
03:04:46FromDiscord<Elegantbeef> I dont like scanning C files, i'm think the usage of the name might be sensible
03:05:20*arkurious quit (Quit: Leaving)
03:05:42FromDiscord<Elegantbeef> I mentioned somewhere about how the files end with `picostdlib@[email protected]`
03:05:56FromDiscord<Elegantbeef> That's the least ugly solution imo
03:06:24FromDiscord<auxym> yeah that sounds reasonable to me too
03:07:35FromDiscord<Elegantbeef> The down side is that it requires a new `piconim` executable every update
03:08:58FromDiscord<auxym> every update of what?
03:09:22FromDiscord<Elegantbeef> picostdlib, anytime a new module is added that needs to be linked
03:09:26FromDiscord<Elegantbeef> I assume we dont have them all
03:11:42FromDiscord<auxym> oh, well every time you add a new module, you need to add the logic to detect it in piconim? Sounds reasonable I think
03:12:35FromDiscord<Elegantbeef> Well i might make a PR for that variant tomorrow
03:13:18FromDiscord<Elegantbeef> Dont know about the cmake stuff whatsoever though\`
03:14:21FromDiscord<auxym> yeah pretty new to me too. I'm trying to get a barebones POC working for tinyusb HID. it's a pita.
03:17:13FromDiscord<Elegantbeef> Yea that was my experience with attempting to get tinyusb to work
03:17:57FromDiscord<auxym> i got their C example working, even modified for CDC+HID composite, now trying to mix in Nim
03:19:04FromDiscord<Elegantbeef> Yea i had the C stuff working, just not anything with Nim compiling
03:20:45FromDiscord<auxym> you're supposed to implement callbacks that they declare in headers, say `uint16_t tud_hid_get_report_cb(uint8_t instance, uint8_t report_id, hid_report_type_t report_type, uint8_t buffer, uint16_t reqlen)` where `hid_report_type_t` is an enum
03:21:07FromDiscord<Elegantbeef> Yea i have macros for that
03:21:13FromDiscord<Elegantbeef> Or templates
03:21:57FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWK
03:22:16FromDiscord<auxym> But nim exports the enum type as `long int` and that fails to compile :S
03:23:09FromDiscord<Elegantbeef> Are you doing `{.size: sizeof(uint16)}`?
03:24:32FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWL
03:24:39FromDiscord<Elegantbeef> Well there is your problem
03:25:11FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWL
03:25:21FromDiscord<Elegantbeef> Is it supposed to be `sizeof(byte)`?
03:25:26FromDiscord<auxym> wait
03:25:50FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWM
03:26:03FromDiscord<auxym> are enums not `int` by default?
03:26:07Amun-Rathey are
03:26:15FromDiscord<Elegantbeef> Do i look like a C programmer to you?
03:26:36FromDiscord<Hamid_Bluri> LOL beef
03:26:49*sagax quit (Ping timeout: 256 seconds)
03:27:01FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWN
03:27:13FromDiscord<auxym> the only discrepancy is the enum:
03:27:32FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWO
03:27:55FromDiscord<auxym> nim exports `long int`, gcc is expecting `hid_report_type_t`
03:28:13FromDiscord<Elegantbeef> Oh you're not doing `importC: "hid_report_type_T"`
03:28:36FromDiscord<auxym> no. i can try that though
03:30:50FromDiscord<Rika> im back hello
03:31:01FromDiscord<auxym> well that's working 👍
03:31:08FromDiscord<Rika> what shenanigans are you folk up to now
03:31:13FromDiscord<auxym> c stuff
03:31:16FromDiscord<Rika> i c
03:31:19FromDiscord<auxym> fun times
03:33:28FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWQ
03:33:43FromDiscord<auxym> how can I get nim to output that `const unsigned char` signature?
03:33:46FromDiscord<Rika> i dont remember if nim had a way of representing const
03:34:02FromDiscord<Elegantbeef> https://github.com/beef331/picostdlib/blob/master/src/picostdlib/tusb.nim#L174-L223
03:34:24FromDiscord<Rika> lol thats major pain
03:35:04FromDiscord<auxym> lol that's ridiculously nicer that what I have atm (a bunch of crappy c2nim output)
03:35:21FromDiscord<Elegantbeef> beef2nim
03:42:24FromDiscord<auxym> unfortunately your `setReportCb` implementation seems to have the same result: gcc rejects it because it's lacking a `const` on a param
03:42:45Amun-Raauxym: that's how I do it: https://play.nim-lang.org/#ix=3LWS
03:44:26FromDiscord<auxym> I think I want to `exportc` a proc though? TinyUSB wants the user to implement some functions (callbacks) that they declare a signature for in their header
03:45:31FromDiscord<auxym> I can't call `foo`, because there's no actual implementation in the c code
03:45:35Amun-Rayou have to use {.cdecl.}
03:46:36Amun-Raproc somecallback(some c typed params) {.cdecl.} = …
03:46:51FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=3LWT
03:47:09FromDiscord<auxym> Can I get nim to output that `uint8_t const` signature though?
03:47:34FromDiscord<Elegantbeef> with the `codegendecl` procs
03:47:34FromDiscord<Elegantbeef> On the procs\
03:48:00FromDiscord<auxym> ah yeah, I guess that'd be the only way
03:50:38FromDiscord<auxym> anyways, enough fun for tonight, gotta sleep
04:06:39*adigitoleo quit (Remote host closed the connection)
04:07:22*adigitoleo joined #nim
04:11:58arkanoidwhat are the cons of -d:useMalloc? I use it to run valgrind and check for leaks, but I'm not aware what are the cons of leaving it enabled
04:13:51*rockcavera quit (Remote host closed the connection)
04:23:34nrds<Prestige99> Been having a lot of issues recently reporting through nimlsp by nimsuggest, but the code compiles and runs just fine. Anyone else been having issues?
04:25:36nrds<Prestige99> e.g. https://play.nim-lang.org/#ix=3LX0 https://i.imgur.com/oieV8uc.png
04:27:07FromDiscord<Elegantbeef> Is your nimlsp/nimsuggest not the same version as your compiler?
04:27:29FromDiscord<Elegantbeef> Nevermind that compiles all the way back in 0.13.0
04:29:53nrds<Prestige99> Maybe I'll just ping PMunch about it when he's around, see if he has an idea
04:29:58nrds<Prestige99> I'm on 1.6.2
04:32:16nrds<Prestige99> ah it's actually just a nimsuggest bug
04:32:34nrds<Prestige99> Was able to repro just using nimsuggest, chk 1 on the file
04:32:42FromDiscord<Elegantbeef> Ah
04:33:37FromDiscord<Elegantbeef> Wait you do `nimsuggest file.nim` then `chk 1`?
04:33:44nrds<Prestige99> yeah
04:33:52nrds<Prestige99> happens in 1.6.0 but not 1.4.8
04:34:19FromDiscord<Elegantbeef> Ah doesnt happen on devel
04:34:25nrds<Prestige99> oh
04:34:43FromDiscord<Elegantbeef> Wait nvm it does
04:34:46nrds<Prestige99> it does for me with devel
04:34:47FromDiscord<Elegantbeef> I somehow wasnt on devel 😀
04:34:57nrds<Prestige99> I'll just downgrade to 1.4.8 for now and file a bug
04:35:17FromDiscord<Elegantbeef> I dont like this bug since it might be related to me
04:35:25nrds<Prestige99> lol
04:35:41nrds<Prestige99> It also happens on base methods, very easy to repo. It says they aren't a base
04:36:37FromDiscord<Elegantbeef> Testing with my code breaker
04:40:05FromDiscord<Elegantbeef> Try with this commit https://github.com/nim-lang/Nim/commit/f373c17ad926b669bb3b5819ae1dff4bde1da88a
04:41:43nrds<Prestige99> Is there an easy way to do that with choosenim?
04:42:56FromDiscord<Elegantbeef> You should be able to do `choosenim install #commitHash`
04:44:59nrds<Prestige99> ah it's choosenim #f373c17ad926b669bb3b5819ae1dff4bde1da88a
04:45:05nrds<Prestige99> I tried without the # before
04:45:16*cyraxjoe quit (Quit: No Ping reply in 180 seconds.)
04:45:32nrds<Prestige99> Filed https://github.com/nim-lang/Nim/issues/19371 - I'm building that commit now
04:45:35FromDiscord<Elegantbeef> If that doesnt fail try the next commit
04:46:41*cyraxjoe joined #nim
04:46:56nrds<Prestige99> failed to build
04:47:26nrds<Prestige99> /home/avahe/.choosenim/toolchains/nim-#f373c17ad926b669bb3b5819ae1dff4bde1da88a/config/nim.cfg(16, 1) Error: invalid command line option: '--hint'
04:47:45nrds<Prestige99> Gonna get dinner I'll be back in a bit
04:47:50FromDiscord<Elegantbeef> Odd
04:51:51*vicfred joined #nim
04:53:55arkanoidspeaking of nimsuggest, do you have any idea if it is expected it to consider nim files into .cache/nim/myproject_* ?
04:54:19arkanoidbecause if yes, I have a problem, if no, I should open a ticket to PMunch
04:55:05FromDiscord<Elegantbeef> Well if they're importable they should be considered
04:55:18FromDiscord<Elegantbeef> if the compiler can find them so should the tooling
04:58:49arkanoidso I have a problem
05:00:00FromDiscord<Rika> yes
05:01:27arkanoidbut how can I track it down? I am using futhark that generates a nim file in .cache/nim/myproject_d/, if I leave it there I have hundreds of errors in vscode but the code compiles and runs. If I copy the generated nim file into local dir and import it instead of running futhark I've zero errors and code completion works nicely
05:03:15arkanoidI have a define to switch between the two behaviors, it is immediate: just commenting "--d:futhark" in config.nims makes the errors appears again, but compilation works https://github.com/arkanoid87/nimmap/blob/faa3d11411ee0d029fa3a4f958ce31be1633ca00/src/nimmap.nim#L8
05:10:15FromDiscord<Elegantbeef> You might be able to add a `config.nims` with `--path:"~.confing/nim/myproject_d`
05:10:20FromDiscord<Elegantbeef> Thought not overly safe
05:11:22arkanoidlet me try
05:12:34arkanoidin my case I think it should be --path:"~/.cache/nim/nimmap_d"
05:13:26arkanoidbut no, it is not working
05:13:52FromDiscord<leorize> I don't think the compiler resolve `~` in path
05:14:04arkanoidtarget file is "/hom/jack/.cache/nim/nimmap_d/futhark_ABCBC588AD64774C.nim"
05:14:12arkanoid*home
05:14:54arkanoidbut even --path:"/home/jack/.cache/nim/nimmap_d" does not solve the problem
05:15:30arkanoidif I copy futhark_ABCBC588AD64774C.nim into ./src/gdal.nim and do "import gdal" I have perfectly fine error correction/completion
05:27:55*Lord_Nightmare2 joined #nim
05:35:11*szahid quit (*.net *.split)
05:35:12*lain quit (*.net *.split)
05:35:12*dv^_^ quit (*.net *.split)
05:35:12*Lord_Nightmare quit (*.net *.split)
05:35:13*arkanoid quit (*.net *.split)
05:35:13*def- quit (*.net *.split)
05:35:13*drewr quit (*.net *.split)
05:35:13*tinystoat quit (*.net *.split)
05:35:13*flynn quit (*.net *.split)
05:39:55*Lord_Nightmare joined #nim
05:39:59*Lord_Nightmare2 quit (Ping timeout: 256 seconds)
05:40:13*lain joined #nim
05:40:13*szahid joined #nim
05:40:13*dv^_^ joined #nim
05:40:13*arkanoid joined #nim
05:40:13*def- joined #nim
05:40:13*drewr joined #nim
05:40:13*tinystoat joined #nim
05:40:13*flynn joined #nim
05:46:55nrds<Prestige99> @Elegantbeef I'm back, not sure why that isn't building. Are you able to build that commit?
05:47:54adigitoleodo I need to explicitly close the `File` of a `FileLogger`?
05:52:08FromDiscord<Elegantbeef> I'm not prestige even from source atm
05:52:24nrds<Prestige99> hm
05:53:43FromDiscord<Elegantbeef> Building it now i guess
06:01:44FromDiscord<Elegantbeef> Yea that's not the breaking change it seems
06:03:23FromDiscord<Elegantbeef> Built with that commit and also borked
06:05:29FromDiscord<Elegantbeef> So yay for me
06:13:32nrds<Prestige99> Could probably git bisect to figure out the commit, if it'll build that is :P
06:13:41nrds<Prestige99> know it's a 1.6.0 bug
06:14:01FromDiscord<Elegantbeef> well it's between 1.4.8 and that commit
06:14:11nrds<Prestige99> yeah
06:14:40FromDiscord<Elegantbeef> I'm a numpty that just randomly chooses commits and guesses
06:20:21nrds<Prestige99> git bisect is great
06:59:23*adigitoleo quit (Remote host closed the connection)
07:00:06*adigitoleo joined #nim
07:14:55*jjido joined #nim
07:24:59*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
07:30:29*PMunch joined #nim
07:35:26*jjido joined #nim
07:49:31FromDiscord<Rika> pmunch do you think its worth it to make a futhark kinda thing that works more like c2nim than a macro or w/e
07:49:54FromDiscord<Rika> im really not liking the macro idea so far, and would much rather edit the converted file directly
07:50:17PMunchWell, you're free to copy the file out and edit it to your hearts desire
07:50:36PMunchIt completely defeats the purpose though, but I'm not going to arrest you for it
07:51:26FromDiscord<Elegantbeef> Of course not norway doesnt have extradition agreements with all the nations of the world!
07:51:55PMunchThe whole point of Futhark is to bring C files into Nim exactly as they are, with some support for changing types if you want to make a more strict alias or something.
07:52:19FromDiscord<Rika> well its not enough support for what i want to do
07:52:46PMunchAs soon as you edit the Futhark output you've broken the possibility of rebuilding if a new version of the library comes out
07:52:54PMunchWhat do you want to do?
07:53:02FromDiscord<Rika> that's already broken given that i am making a full wrapper and not a thin wrapper
07:53:27PMunchThe idea is that you take the C code into Nim exactly as it appears, then you write your wrapper on top, calling the functions from the library.
07:53:33NimEventerNew post on r/nim by Familiar_Ad_8919: why do we have to import everything, see https://reddit.com/r/nim/comments/s20r04/why_do_we_have_to_import_everything/
07:53:45FromDiscord<Rika> converting C-style flags (or'ed ints) into sets is somewhat hairy
07:53:53PMunchThis way you will get type mismatch errors if the library updates
07:54:05arkanoidPMunch: I'm still on that weird clang bug, it's strange, I've been working successfully with futhark until couple hours ago and then suddenly SIGSEGV
07:54:11PMunchInstead of silent errors that suddenly crashes or allows exploits on runtime
07:55:03PMunchHmm, that is very unfortunate. I do remember having some SIGSEGVs while I was developing it, but that was just me actually making mistakes and all those should be fixed
07:55:28PMunchI mean the error comes from the clang library, so I'm not entirely sure what we can do about it
07:55:28FromDiscord<Rika> then what would be a better way for me to change what i said
07:55:42FromDiscord<Rika> or'ed ints into sets and enums
07:55:58arkanoidPMunch: I agree with leaving the generated futhark nim file in .cache/nim/myproject_*, but the issue with that is that nimsuggests seems not picking it's contents for helping users out. I have to copy that file into local project folder and remove futhark to get bindings+nimsuggest working correctly
07:55:58FromDiscord<Elegantbeef> Templates/procs that do the Nim \<-\@Rika)
07:56:07FromDiscord<Rika> no
07:56:13FromDiscord<Rika> inelegant to me
07:56:20arkanoidjust like here: https://github.com/arkanoid87/nimmap/blob/master/src/nimmap.nim
07:56:22PMunchWell that's the way to do it
07:56:27FromDiscord<Elegantbeef> I agree but that's what pmunch suggests if you want
07:56:28arkanoidsorry: https://github.com/arkanoid87/nimmap/blob/faa3d11411ee0d029fa3a4f958ce31be1633ca00/src/nimmap.nim#L8 here
07:56:43FromDiscord<Elegantbeef> You can always use futhark like c2nim and just copy the nim files
07:56:56FromDiscord<Elegantbeef> There is nothing stopping you from automating half the process
07:57:22PMunchYou overload the proc you want to "fix" with a version that takes a set and then you do the conversion and call the underlying function
07:57:40FromDiscord<Rika> its not just a proc
07:57:41FromDiscord<Rika> its a type as well
07:58:08PMunchSame concept applies to types
07:58:36PMunchYou shouldn't force Nim to think C code is something else than what it is. Just build your abstractions on top of the C code like a sane person
07:58:39FromDiscord<Elegantbeef> You do the cast internally with the template/proc
07:58:40FromDiscord<Rika> there are facilities for me to add prefixes to every symbol right
07:58:45FromDiscord<Rika> if there are then that would be better
07:59:28PMunchYes, you can create a rename hook (a procedure that gets called upon to rename things)
07:59:39PMunchAnd then just add a prefix or postfix that way
08:00:18arkanoidoh, I've just found that also Yardanico faces the "var cursor = getTranslationUnitCursor(unit)" SIGSEGV, but that happened 01-12-2021
08:00:35PMunchOr you can have a module that runs Futhark and then have `from myWrapper import nil` and then have to prefix everything with `myWrapper`
08:00:49FromDiscord<Rika> okay]
08:00:55FromDiscord<Rika> good enough
08:01:15PMuncharkanoid, did you check the clang library headers and compare them to the wrapper I use?
08:01:47arkanoidwhich wrapper?
08:02:04PMunchThis one: https://github.com/PMunch/futhark/blob/master/futhark.nimble#L15
08:03:44arkanoidno I havent, but I need some more hint to understand where to check, it's a log of text there
08:04:38PMunchWell I was thinking compare the call at the point of the SIGSEGV from that wrapper to the actual libclang header on your system
08:05:17arkanoidsure, let me get it
08:07:09arkanoidI've already checked that the symbol is present in /usr/lib/x86_64-linux-gnu/libclang-10.so.1
08:07:36arkanoidbut "rg clang_getTranslationUnitCursor" in "/usr/lib/clang/10/include" returns zero results
08:08:06PMunchWell it would probably be called get_translation_unit_cursor or something I guess
08:08:28PMunchWait, clang/10?
08:08:41PMunchThat might be why, I'm running clang/13.0.0
08:09:51arkanoidthe importc in index.nim is "proc getTranslationUnitCursor*(a1: CXTranslationUnit): CXCursor {.importc: "clang_getTranslationUnitCursor", cdecl.}"
08:10:15arkanoidnm -D /usr/lib/x86_64-linux-gnu/libclang-10.so.1 | grep clang_getTranslationUnitCursor results in 00000000003cf1c0 T clang_getTranslationUnitCursor
08:10:45arkanoidnm -D /usr/lib/x86_64-linux-gnu/libclang-12.so.1 | grep clang_getTranslationUnitCursor results in 0000000000455710 T clang_getTranslationUnitCursor
08:10:57arkanoidI have more than one libclang installed
08:11:24arkanoidBut I've been always working with the v 10 so far, and futhark behaved correctly
08:11:40PMunchOh right, I see
08:11:42arkanoid(10 is the one shipped with ubuntu 20.04 LTS)
08:12:40arkanoidI get same error with both versions (nim c --passl:"-lclang" opir.nim, nim c --passl:"-lclang-12" opir.nim)
08:12:48*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:14:18arkanoidquestion is why I don't ripgrep it in clang headers folder
08:14:28arkanoidis it a private function?
08:14:30PMunchI can't seem to find it either
08:15:46arkanoidseems documented https://clang.llvm.org/doxygen/group__CINDEX__CURSOR__MANIP.html#gaec6e69127920785e74e4a517423f4391
08:15:47PMunchAha, on my system it's in /usr/include/clang-c
08:17:32arkanoidzero results in my /usr/include/clang
08:17:54arkanoidI see it should be in index.h https://github.com/hdoc/llvm-project/blob/a6ad3505abc7409abd2a4118338b9c85ec2e9f09/clang/include/clang-c/Index.h#L2729
08:20:56arkanoidgot it, is in /usr/lib/llvm-12/include/clang-c/Index.h
08:23:01arkanoidthe original signature is "CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);"
08:23:22PMunchYeah I just asked my package manager to list all the files installed for `clang` and then grepped that list for Index.h
08:23:41PMunchThat's the same as it is for me
08:25:32FromDiscord<Rika> whats the recommended enum entry naming scheme nowadays>
08:25:34FromDiscord<Rika> (edit) "nowadays>" => "nowadays?"
08:26:26arkanoidwhat if the problem in in a linked library used by libclang? https://termbin.com/txld
08:29:18PMunchI guess we could see if we could find a clang/llvm channel to ask these questions in :P
08:29:22PMunchMight be more productive
08:29:33PMunchAnd @Rika, I'm not sure TBH
08:31:12PMunchI used to be a fan of pure enums..
08:31:20FromDiscord<Rika> i recall not exactly needing to prefix enum names with prefixes anymore but yeah
08:31:33FromDiscord<Rika> they can be disambiguated easily nowadays ig
08:31:39PMunchOf course
08:31:54FromDiscord<Elegantbeef> there is the experimental overridedable enums\:D
08:32:18FromDiscord<Rika> @_@
08:32:44PMunchOverrideable?
08:33:00FromDiscord<Elegantbeef> Cant tell if that's a correction or asking
08:33:15FromDiscord<Rika> asking likely
08:33:19FromDiscord<Elegantbeef> Overloadable enum sorry
08:33:28FromDiscord<Elegantbeef> https://github.com/nim-lang/RFCs/issues/373 RFC
08:33:54FromDiscord<Elegantbeef> Why arent they in the manual somewhere, no clue
08:34:09FromDiscord<Elegantbeef> Ah nvm i'm dumb they're in the normal manual
08:34:11FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#types-overloadable-enum-field-names
08:34:18FromDiscord<Elegantbeef> Not the experimental manual
08:34:21PMunchI've just never heard of them before :P
08:34:56FromDiscord<Elegantbeef> They're new in 1.6.0
08:35:14FromDiscord<Rika> so do i still prefix or not xd
08:35:26FromDiscord<Elegantbeef> If you use overloadable you do not
08:35:35FromDiscord<Elegantbeef> otherwise it's up to you
08:35:39FromDiscord<Rika> if i dont since this is a library
08:36:28FromDiscord<Elegantbeef> personally i prefer prefix
08:36:49FromDiscord<Elegantbeef> I dont like the name spacing
08:36:55FromDiscord<Rika> why not
08:37:07FromDiscord<Rika> personally im torn
08:37:12FromDiscord<Rika> both have upsides and downsides
08:37:17FromDiscord<Elegantbeef> It's just tedious especially when there no ambiguity
08:37:17FromDiscord<Rika> and im not sure which is better
08:37:51FromDiscord<Elegantbeef> like if you have `a: MyEnum` i do not like typing `myObj.a = MyEnum.myEnumVal`
08:37:51FromDiscord<Rika> if theres no ambiguity then you dont have to "namespace" i thought?
08:38:20FromDiscord<Elegantbeef> I always forget the semantics for enums so i dont recall at the moment
08:38:51FromDiscord<Elegantbeef> Just dont write your library until 1.8 or 2.0 whenever overloadables are stable 😀
08:39:11FromDiscord<Rika> gotcha, delay my program by a century
08:39:22FromDiscord<Elegantbeef> Indeed
08:39:29FromDiscord<Rika> though i dont know if ill live to 120
08:39:34arkanoidPMunch: I'm asking in #llvm (oftc) and first idea is ABI mismatch
08:39:43FromDiscord<Elegantbeef> Well good luck
08:39:52arkanoidnot sure how to handle this hint in our context
08:39:54FromDiscord<Elegantbeef> Hopefully no one needs the library you're wanting to write
08:40:12FromDiscord<Rika> prolly not, this is a convenience wrapper more than a thin one
08:40:36FromDiscord<Rika> theres already a thin wrapper of it but its not "updated" i think or its slightly wrong which led to errors
08:41:01PMunchMaybe try to wrap clang with Futhark and see if it gives you the same signature :P
08:43:25arkanoidfuthark inception
08:45:19arkanoidwell, the original signature is "CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);", it's just matter of expanding the macros with preprocessor
08:46:58arkanoiddone, here's the expanded version "__attribute__((visibility("default"))) CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);"
09:07:17*sagax joined #nim
09:13:02PMunchHmm, that looks like it should match what the wrapper says
09:15:33arkanoidPMunch: I've recovered the list of the installed packages before the error, and matched it with the dynamic libraries needed by libclang
09:15:51arkanoidthe only thing that pops out is linux-libc-dev:amd64 (5.4.0-92.103, 5.4.0-94.106)
09:16:00arkanoidbut not sure if that means anything
09:17:31arkanoidthat package only contains header files, and here it doesn't seem that the error is driven by a .h import
09:17:34arkanoidbut not sure
09:19:53arkanoidwhat puzzles me is that the error seems to be into clang-*.so no matter the version
09:20:23*Gustavo6046 quit (Quit: Leaving)
09:24:32PMunchThis happens with all C files right?
09:24:47PMunchYou can't create a simple hello world header and it works?
09:28:39arkanoidI've been trying to compile a different (old) project that was working before (libgiintrospection) and I got same error. I'm going to build a barebone test case
09:28:42*jjido joined #nim
09:35:06arkanoidPMunch: I've created a test similar to the one in your readme using single stb file, but I'm getting same SIGSEGV
09:35:40arkanoidopir -I/usr/lib/clang/10/include -I/home/jack/nim/futhest/stb /home/jack/.cache/nim/futhest_d/futhark-includes.h
09:35:43PMunchHmm
09:36:18arkanoidsigsegv is always at /home/jack/.nimble/pkgs/futhark-#head/opir.nim(343) opir
09:36:41arkanoidin the meanwhile I've installed clang-11, so now I have 3 versions to test agains
09:37:00PMunchWhy not clang-13?
09:37:15*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:37:44arkanoidbecause it is not present in ubuntu LTS repository
09:38:16arkanoidopir compiles and links successfully to all 3, but same sigsegv
09:41:43PMunchSince a update triggered it and none of those versions fix it I think this might be related to another dependency of clang..
09:42:18*jjido joined #nim
09:47:27arkanoidPMunch: sure, but gdb should point to it
09:47:53PMunchWhat does it point to now?
09:48:06arkanoidor at least the backtrace would show libclang calling a symbol in another .so
09:50:05arkanoid0x00007ffff62a81d3 in clang_getTranslationUnitCursor () from /usr/lib/x86_64-linux-gnu/libclang-10.so.1
09:51:13PMunchThat's the last part?
09:52:09*Figworm quit (Ping timeout: 256 seconds)
09:53:29arkanoidyes, the gdb backtrace stops there
09:53:36arkanoidbefore that is nimland
09:53:47arkanoid#0 0x00007ffff62a71d3 in clang_getTranslationUnitCursor () from /usr/lib/x86_64-linux-gnu/libclang-10.so.1
09:53:53arkanoid#1 0x0000555555592c52 in NimMainModule ()
09:54:57PMunchHmm
09:56:37*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:56:51PMunchIt's really hard to help you when it doesn't crash for me..
09:58:48arkanoidI wish I didn't do that apt upgrade
09:59:27arkanoidbut it should have a meaningful explanation. It's a compiled .so, and that had not been upgraded
10:07:34PMunchYeah, I mean it has to be *something* in that update you did which caused it
10:08:40PMunchThis is part of the reason I switched to Arch in the first place. Apt just lagging so far behind on packages. I mean even if you find the error it is likely that it has been fixed like a year ago and you just have to wait for the next release
10:11:01*Figworm joined #nim
10:11:02arkanoidPMunch: if I need an upgraded package I have many different alternative ways (nix, container, vm), but here I'm dealing with something that was working before without apparent change in the relevant file
10:11:14arkanoidhere's the list of the upgraded packages: https://termbin.com/pna3
10:11:25FromDiscord<Rika> Could it be the fact that you didn’t update somehow
10:11:53arkanoidRika, what do you mean?
10:13:44arkanoidgdb shows that the error is in /usr/lib/x86_64-linux-gnu/libclang-10.so.1 and here's the stats: https://termbin.com/eqb7 last change is more than 1 month old
10:15:18arkanoidand if we consider the modification date, is more than 8 months
10:20:10PMunchThat could be when it was built though, file timestamps can be wonky
10:22:52arkanoidSure, you can hack them, but thats not what server distros generally do. Other like nix do them for every package for reproducible builds
10:27:45PMunchOh I just meant like if you unzip a folder for example you get the original timestamps
10:34:48arkanoidSure it is the build time. The last time a .so is modified is hopefully the linking time.
10:35:06arkanoidOr some patchelf hack
11:17:18NimEventerNew question by Clarence Liu: Nim Compile - Modify default compile flags on MacOS - issue with clang ld: library not found for -lrt, see https://stackoverflow.com/questions/70680615/nim-compile-modify-default-compile-flags-on-macos-issue-with-clang-ld-libra
11:26:35FromDiscord<hmmm> yo doods what libs would you use to create something like this in nim https://media.discordapp.net/attachments/371759389889003532/930784821423251486/thing.PNG
11:30:48FromDiscord<Rika> What
11:30:51FromDiscord<Rika> Like what’s
11:30:56FromDiscord<Rika> Graph generation?
11:30:58FromDiscord<Rika> Sorting?
11:31:02FromDiscord<Rika> Hash tables?
11:31:39PMunchShuffling algorithm?
11:32:27FromDiscord<hmmm> like some graphical representation that connects similar element from 2 lists. I'll figure the backend logic, I'm just looking for what can I use for the presentation part
11:34:42FromDiscord<hmmm> I started looking at plots options in python since they have massive libs but still not finding something that models arrows
11:34:57FromDiscord<Rika> So a graph library
11:35:03FromDiscord<hmmm> yea something like that
11:40:05PMunchNeat, trimmed some unnecessary code off-of my keyboard firmware, it is now smaller than the Blink example from Arduino :P
11:40:49PMunch@hmmm, easiest is probably just to have Nim output Dot/graphviz definitions and then use that tool to build the graph
11:42:01PMunchAh there are apparently also some bindings for it: https://github.com/Aveheuzed/nimgraphviz
11:42:10PMunchSo you don't have to create a file and build it externally
11:48:17FromDiscord<hmmm> graphviz seems like a strong option, still looks a bit heavy weight for my usecase but I can see it working. I want to try to look if I find easier options before committing tho
11:48:27FromDiscord<hmmm> ty pmunchie 👑
12:06:12*fvs joined #nim
12:15:56FromDiscord<hmmm> scratch that, nimgraphviz is perfect 😃 https://media.discordapp.net/attachments/371759389889003532/930797241772441610/test_graph.png
12:19:26PMunchI mean it's been around for ages and is built for exactly this kind of thing
12:19:32PMunchSo you'd expect it to be good
12:21:14FromDiscord<vindaar> definitely better than 'plotting' it \:P
12:21:18FromDiscord<vindaar> funny\_arrows.png https://media.discordapp.net/attachments/371759389889003532/930798591570739230/funny_arrows.png
12:21:38FromDiscord<vindaar> (yeah, yeah, I didn't feel like creating a proper arrow 🤣)
12:21:42FromDiscord<hmmm> hey how you did that vind
12:21:57FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=3LYJ
12:22:18FromDiscord<hmmm> dataframes and ggplot
12:22:38FromDiscord<hmmm> it's very good tbh
12:23:50FromDiscord<hmmm> I mean dataframes are like the best structure to model my stuff since it's basically 2 lists that gets connected with some logic
12:25:35FromDiscord<vindaar> well, that may be the case, but I'd still opt for generating graphviz based on the data (maybe use some DF logic for some processing before, sure). At least graphviz gives you a nice figure without specifying everything
12:54:36*rockcavera joined #nim
12:54:36*rockcavera quit (Changing host)
12:54:36*rockcavera joined #nim
13:03:09*jjido joined #nim
13:11:47*yann-kaelig joined #nim
13:12:44yann-kaeligHello
13:12:59yann-kaeligMaybe you have read this news https://www.bleepingcomputer.com/news/security/dev-corrupts-npm-libs-colors-and-faker-breaking-thousands-of-apps/
13:13:27yann-kaeligI wonder how this similar things could not happen on nim and why ?
13:13:48FromDiscord<mratsim> In reply to @yann-kaelig "I wonder how this": use lockfiles
13:17:16FromDiscord<Rika> It can happen
13:17:57yann-kaeligI don't understand. So I should use a lockfiles on all the ecternal packages available for nim, to prevent that maybe one day a dev of an external package available for nim could be corrupted ? How can I be also sure that a new package added to the list of nim-lang/packages is "clean"
13:18:34FromDiscord<mratsim> In reply to @yann-kaelig "I don't understand. So": You audit the package
13:18:57FromDiscord<mratsim> and before updating you lock at the diff
13:19:13FromDiscord<mratsim> (edit) "lock" => "look"
13:19:29FromDiscord<xx_ns> In reply to @yann-kaelig "I don't understand. So": this problem exists with all dependency managers regardless of language
13:19:41FromDiscord<xx_ns> and to an extent, all package managers even for linux distros
13:19:59FromDiscord<xx_ns> the difference being that uploaded linux distro packages are usually vetted by a central authority
13:20:16FromDiscord<mratsim> There is a reason supply chain attacks are getting more popular, especially on Pypi and NPM, it's effective
13:20:57FromDiscord<Rika> People aren’t taught in mitigating the attacks yet I guess
13:21:49yann-kaeligI never heard of this on a language like C or C++. Apologize for my ignorance, maybe I missed something that I should learn.
13:22:06FromDiscord<mratsim> because C and C++ don't have a package manager
13:23:00yann-kaeligok, I was aware of that, so there is an issue with these new languages making use of package manager
13:23:32FromDiscord<mratsim> well even distro packaged C libraries can break everything cough systemd
13:23:50FromDiscord<mratsim> someone somewhere needs to spend time
13:24:08FromDiscord<mratsim> it can be the one who depends on that library, a distro maintainer or the end user
13:24:10FromDiscord<Rika> It’s a problem in C and C++ if you use a package manager
13:24:13FromDiscord<Rika> It’s not inherent to the language
13:25:17FromDiscord<mratsim> glibc manages to break everything every couple years
13:27:17*neurocyte0917 quit (Read error: Connection reset by peer)
13:28:25*neurocyte09170 joined #nim
13:31:28FromDiscord<haxscramper> I think it is inherent to the algorithm used
13:31:44FromDiscord<xx_ns> In reply to @yann-kaelig "I never heard of": c/c++ projects usually either simply import symbols from shared libraries on the system where the executable is.. executed, or libraries are compiled in statically in which case they are vendored in the source tree and vetted
13:31:49FromDiscord<haxscramper> pull-highest vs pull-lowest, and former is more "convenient" as recent discussion indicated
13:31:56FromDiscord<xx_ns> ie - supply chain does not include an untrusted link
13:32:09FromDiscord<haxscramper> viewed as more convenient by some people
13:37:15PMunchI guess GitHub has tried to help with this recently. For popular languages you will get security warnings if you depend on a package that is tagged as insecure.
13:37:25PMunchOf course then it might be too late
13:38:31PMunchBut yeah, if you lock your versions you should be safe (and vet any updates). It still boggles me how many people have stuff breaking when a rogue dev pushes an edit to a package. Do their live environments just pull in new versions willy-nilly?
13:39:06FromDiscord<Rika> Yes
13:39:09PMunchThat being said Nimble, unlike NPM, doesn't actually host any packages. So even if you have locked your versions a dev can still just delete their repo..
13:39:23PMunchAnd if you don't have a backup you're out of luck
13:39:42FromDiscord<Rika> NPM hosting the packages doesn’t help, the owner could probably still delete their package
13:39:52PMunchI'm assuming the lockfile system uses hashes, otherwise they could also hard-push exploits
13:40:12PMunch@Rika, AFAIK you can't remove or edit previous versions
13:40:19PMunchThe only thing you can do is push a new one
13:41:25FromDiscord<xx_ns> as a rule of thumb, i commit my node_modules directory alongside source code. This way, diffs between pulled dependencies are highlighted by git itself, which makes it super easy to vet differences. As an added bonus, my CI pipeline does not require internet access after the initial git clone
13:42:13FromDiscord<xx_ns> coincidentally enough, I am currently conducting a supply chain attack proof of concept on npm right this second (I'm a security researcher)
13:42:27FromDiscord<xx_ns> i unpublished a package, but have to wait 24 hours before i can publish it again
13:43:25FromDiscord<xx_ns> getting a 403 `<package-name> cannot be republished until 24 hours have passed.`
13:44:25*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:45:31PMunch@xx_ns, adding node_modules to your git repo is a nice way to make your Git repo huge and unwieldy. Generally it's not recommended to do that
13:46:16yann-kaeligWell, not talking only about security, but I have the feeling that something is wrong with nim, rust, npm and all others languages that use the package manager model. The fact that it is based on one person and everything that comes from that, security, audit and finally the possibility of seeing one day the project disappear. I found a lof of 404 in the nim external package list
13:50:26PMunchThe alternative is writing everything yourself though
13:50:41PMunchAnd using that system you won't get much done
13:51:19PMunchWell, I guess you could wait for someone to set up an organisation to implement libraries for you. But a lot of stuff is maintained by single people
13:51:39FromDiscord<Rika> In reply to @yann-kaelig "Well, not talking only": Well I’m not aware of any other systems that would be better
13:51:43yann-kaeligIn fact it seems to be fine in a corporate or organisation model ( like mozilla and that where rust comes from ) but in a community model, it's too much 'scattered'
13:53:00FromDiscord<xx_ns> PMunch: yes, this is usually what people tell me, but i don't care
13:54:20FromDiscord<xx_ns> it is the approach that google takes, for example
13:54:21FromDiscord<xx_ns> https://www.jackfranklin.co.uk/blog/check-in-your-node-dependencies/
13:54:44PMunch@xx_ns, sure you do you, but posing this as a fix to the problem isn't really helpful, because it's literally the opposite of how you're supposed to use Git
13:55:49FromDiscord<xx_ns> what do you mean by "not supposed to use git"?
13:56:06FromDiscord<auxym> In a company setting, I think the best way would be to set-up an immutable mirror of the packages you use (old versions cannot be removed or modified) and lockfiles on each project. Still can't get around auditing new packages though.
13:56:12FromDiscord<xx_ns> node dependencies are code, and you absolutely are meant to use git to commit code and keep track of its history
13:57:04FromDiscord<xx_ns> you're _not_ supposed to store binaries in git projects (without LFS), but "large amounts of code" is not a problem
13:57:05PMunchSure, but not in your own tree
13:57:26szahidbest ide for nim?
13:57:37szahidvsc?
13:57:37PMunchszahid, depends on which IDE you like
13:57:50PMunchAnd how much you tend to use the IDE
13:57:59FromDiscord<hmmm> In reply to @PMunch "That being said Nimble,": can nimble store backups if you ask with a flag?
13:58:33PMunch@hmmm, I meant the external packages, Nimble is just a huge list of repos with some tags and links to where to find them.
13:58:36FromDiscord<xx_ns> PMunch: i absolutely don't see why not
13:59:00PMunch@xx_ns, well you can start with the list of things from the article you listed
13:59:37FromDiscord<xx_ns> ... the article also details why those issues aren't really issues
13:59:53FromDiscord<hmmm> In reply to @PMunch "<@887269570765791243>, I meant the": no I mean store installed backups on your local machine in a backup folder
14:00:01FromDiscord<xx_ns> from the same article, "As with anything in software engineering, most "rules" are guidelines, and we're able to side-step them when required."
14:00:27PMunchI mean if you want to speed up builds, keep a consistent set of packages, etc. you can create another repo with just your node modules that you update when you need it, and then submodule that or something.
14:01:13PMunch@xx_ns, oh yeah, as I said I'm not going to tell you not to do this. If it fits your use-case and you don't mind the drawbacks I won't stand in your way. But it's not something I would recommend
14:02:12FromDiscord<xx_ns> i'm just a tad miffed at the statement that my recommendation is "not helpful" when it has clear benefits and is used by very large companies
14:02:51FromDiscord<xx_ns> the latter being anecdotal, of course, but proof that it works in practice
14:03:19PMunchSorry, I didn't mean that is wasn't helpful at all, just that it wasn't helpful as a general solution to the package manager issues debate
14:03:38PMunchDidn't mean to sound so dismissive
14:04:24FromDiscord<xx_ns> of course, no worries, and i agree that it is not a solution to the package management issue in general, just said that as a side note
14:07:17PMunchThe whole problem is quite complex though. Even if you check all you node_modules into your repo there's nothing stopping it from containing a `if epochTime() > 1643000000: staticExec("rm -rf ~")`
14:08:45PMunchAnd maybe one of the dependencies you're holding back from an update was a critical security fix for a non-disclosed security hole. They won't draw too much attention to it because that would mean disclosing the bug, and you will then be vulnerable until you either update or it is disclosed.
14:12:23*lumo_e joined #nim
14:13:25FromDiscord<xx_ns> of course, but you can say that about anything, all dependencies everywhere are ultimately untrusted. The issue with supply chain attacks specifically is the fact that previously benign packages are replaced with malicious versions - when checking node_modules into your tree, you force yourself to be very mindful of vetting dependencies when they are updated
14:13:44FromDiscord<xx_ns> i'm not advocating against regular patch updates at all
14:14:05FromDiscord<xx_ns> rather, even patch updates should not be pulled in blindly
14:14:13PMunchOf course
14:14:36PMunchAt least not if the package isn't actually checked to make sure that it is in fact a patch update
14:15:01PMunchNothing that stops a malicious (or even just ignorant) dev from just ticking up the patch number and rewriting their entire API
14:15:48FromDiscord<hmmm> well apparently the solution is just trust the devs are not out to damage you and just trust them and you will be safe 99.99% of the times, if you need 100% it means you are a business so you have the means to pay someone to inspect the lesser vetted packages every update
14:18:21FromDiscord<xx_ns> ultimately it comes down to your specific use case and balancing software fast (and trusting/using third party dependencies) vs writing secure software (ie - first party dependencies or a vetting procedure for dependencies)
14:18:46FromDiscord<xx_ns> in most cases, companies don't have the resources or simply don't want to go the latter route
14:19:59FromDiscord<hmmm> no one said 100% was free 😃 the alternative is just accept the risk and have some backups for catastrophe scenarios
14:20:09FromDiscord<haxscramper> In reply to @hmmm "well apparently the solution": I bet in several years we will see a lot of "verified by" packages - someone certainly would be willing to monetize on that
14:20:34FromDiscord<xx_ns> that's not a bad business idea
14:20:53FromDiscord<haxscramper> Or maybe this will just become a standard practice, like debian thoroughly reviews things IIRC (not sure how detailed the review is though)
14:21:43FromDiscord<haxscramper> Or maybe more attention will be given to semantic diff tools, to automate patterns like `static(rm rf)`
14:22:15FromDiscord<haxscramper> nobody prevents me from doing `var a = "rm"; var b = "rf` and then merging things together
14:23:03FromDiscord<haxscramper> then maybe some proxy layer for interpreted languages, some kind of stricter "audit" mode, where it tries to see all the paths that execution can take
14:23:36FromDiscord<haxscramper> `if epochTime() > 1643000000:` is probably ok, but what about`when (...): static: kill everything`
14:24:19FromDiscord<xx_ns> as someone who writes malware for a living: there's a million different ways to hide malicious behaviour and backdoors. Ultimately, you _will_ need to be observing behaviour when executed. Static analysis can only get you so far
14:25:16*jjido joined #nim
14:28:13FromDiscord<Tanguy> Is there a way to make a distinct type implicitly convertible to it's original type without converters?
14:30:24FromDiscord<haxscramper> no, for user-defined implicit conversion you need to use `converter`, I don't think there is a way around that
14:34:21PMunchThe "verified by" sounds interesting, but you'd probably be out of business the first time you slip up and a package makes it through your vetting process with some kind of breaking bug..
14:34:36PMunchAnd as @xx_ns pointed out, vetting packages isn't all that easy
14:35:03PMunch@Tanguy, implicit conversion is the whole point of a converter, why do you want to avoid them?
14:38:33FromDiscord<Tanguy> They don't always work
14:39:12FromDiscord<Tanguy> I was hopping for a simpler shortcut with distinct
14:41:00PMunchWell the whole goal of distinct is to *not* make the types implicitly convertible
14:41:42yann-kaelig"all dependencies everywhere are ultimately untrusted" >> That right, but between a dependency built by one person with several users and eyes on it, and a dependency built by many people, I will certainly make more confidence in the second model, the issue being resolved upstream and I have less chance to leave it and touch the 'users'
14:42:10FromDiscord<Rika> In reply to @PMunch "The "verified by" sounds": well i guess thats why many companies should do it
14:42:31FromDiscord<Tanguy> Yes, but I basically need: `type test = distinct int`, test -> int = implicit conversion, int -> test: explicit conversion
14:45:16FromDiscord<Rika> maybe package managers should encourage audits when updating, but thats still a lot of work
14:45:23PMunchThen a converter is what you're supposed to use
14:45:32FromDiscord<Rika> or have a slow rollout? and a feedback system?
14:45:33PMunchWhy do you say they don't always work?
14:45:52FromDiscord<mratsim> NPM and Pypi main feature is low overhead and 0 friction
14:46:06FromDiscord<mratsim> basically it's production readyness vs happy-go-lucky
14:46:11FromDiscord<mratsim> (edit) "readyness" => "readiness"
14:46:41*arkurious joined #nim
14:47:32FromDiscord<hmmm> In reply to @Rika "well i guess thats": since they will be vetting it internally anyway they might as well share it. Not something like verified by since they would implicitly taking responsability but something like "package xyz ver 0.3.0 used by {BigCorp} for {BigCorpProject}" if that version is good for BigCorp to rely on it should be good for the rest of us
14:47:33FromDiscord<Rika> long time no see
14:48:05FromDiscord<mratsim> In reply to @hmmm "since they will be": that's what we do at Status, we pin all dependencies, even our own libraries.
14:48:24FromDiscord<mratsim> and the Nim compiler
14:48:47FromDiscord<Rika> In reply to @hmmm "since they will be": it would need to be a hash of the code and not a version, or the host platform should be like npm and not allow changes to code once pushed and versioned
14:48:50PMunchI mean that's the obvious way to do it
14:49:12PMunch@Rika, I'd still use a hash just in case
14:49:20PMunchNever know when you get mitm-ed
14:49:26FromDiscord<Rika> yeah i guess so
14:49:31PMunchOr maybe NPM itself could get hacked
14:49:41FromDiscord<Rika> i mean if the host is compromised then you cant trust anything there at all anymore
14:49:46FromDiscord<Rika> even hashes
14:50:00PMunch@hmmm, problem is now BigCorp is paying for vetting the package and BigCompetitor can use it for "free"
14:50:14FromDiscord<xx_ns> i mean, packages can be (and are) signed
14:50:18FromDiscord<Rika> In reply to @PMunch "<@887269570765791243>, problem is now": make it anonymous then
14:50:32FromDiscord<mratsim> just like all Linux kernel development is paid by afew and enjoyed by many.
14:50:39PMunch"Someone vetted this" doesn't inspire a whole lot of confidence :P
14:50:46FromDiscord<Rika> vetted by 1, 2, 3, now competitors would need to weigh against "trusting one" or vetting then adding to the auditor count
14:50:50FromDiscord<Rika> i mean thats the point
14:51:06PMunch@mratsim, oh yeah, I was just saying that for some companies they wouldn't care to do this
14:51:15FromDiscord<mratsim> In reply to @Rika "long time no see": 👋
14:51:41*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
14:51:41FromDiscord<Rika> a lot of companies prolly wouldnt care
14:52:04FromDiscord<Rika> such is the issue of open source i guess
14:52:09FromDiscord<mratsim> Talent is a harder problem than competitors to be honest
14:52:22FromDiscord<Rika> ~~technically thats literally the problem that caused the supply chain attack~~
14:52:25FromDiscord<Tanguy> @PMunch in a generic-heavy codebase, I get a nice `Error: cannot instantiate: 'T'` on my generic converter. Will try to do a minimal repro, but in the meantime i'm stuck
14:52:27FromDiscord<mratsim> attract all the talent with your open-source policy and competitors cannot reuse the code 😉
14:52:43FromDiscord<Rika> though the dude has more history than just "not being paid by the big corps that use his code"
14:52:58FromDiscord<mratsim> In reply to @Tanguy "<@!696333749570371585> in a generic-heavy": do you have `foo[T](a: T)` something?
14:53:10FromDiscord<mratsim> cannot isntantiate T is often because you forgot the [T]
14:53:18FromDiscord<mratsim> (edit) "isntantiate" => "instantiate"
14:53:19*lumo_e quit (Quit: Quit)
14:54:23FromDiscord<Tanguy> Yeah yeah, it works on simple use cases, but when embedded in weird generic stuff, fails
14:54:32FromDiscord<hmmm> In reply to @PMunch "<@887269570765791243>, problem is now": since all the BigCompetitors will be slurping BigCorp efforts for free I see great opportunity for GoBigOrDieFastStartup to use all the bleeding edge stuff and become the next BigCorp 😃
14:55:04FromDiscord<mratsim> In reply to @Tanguy "Yeah yeah, it works": I removed all converters from my codebases
14:55:20FromDiscord<mratsim> I had converters for float->complex and it messed up everything.
14:55:32FromDiscord<mratsim> I only do converters scoped by template
14:55:41FromDiscord<Rika> maybe only show the "verified by x" when more than n companies have vetted it? im not sure, this just delays the issue
14:56:33FromDiscord<Tanguy> Yes, I'm not fond of converters, but I need backward compat and so needs to be able to convert the old type to the new one implicitly, basically
14:57:18FromDiscord<mratsim> maybe instead of having the converter generic, you create a template and instantiate only concrete converters
14:57:53FromDiscord<mratsim> like `template createConverter(inType, outType: typedesc): untyped =`
14:58:22FromDiscord<Tanguy> Mhh seems tricky, don't know which types it's going to be used with (it's for the Future type)
15:00:47FromDiscord<mratsim> you can also overload all calls that use the new API
15:01:36FromDiscord<mratsim> you can create an overloading macro similar to https://github.com/mratsim/Arraymancer/blob/61188413abb269471ff5cbf4b9326ddd3c2a38c7/src/arraymancer/private/deprecate.nim#L20-L70
15:03:14FromDiscord<Tanguy> That's pretty cool
15:03:40PMunchI have also had code break with converters. I wonder if there's something "wrong" with them or how they're invoked that is the source for these issues
15:03:41FromDiscord<mratsim> this one is also an overload generator: https://github.com/mratsim/Arraymancer/blob/61188413abb269471ff5cbf4b9326ddd3c2a38c7/src/arraymancer/linear_algebra/helpers/overload.nim
15:03:56FromDiscord<mratsim> I think here it's generics
15:04:32FromDiscord<mratsim> you can just modify this part to call a conversion procedure that doesn't need to be a converter - https://github.com/mratsim/Arraymancer/blob/61188413abb269471ff5cbf4b9326ddd3c2a38c7/src/arraymancer/linear_algebra/helpers/overload.nim#L14
15:05:11FromDiscord<mratsim> usage: https://github.com/mratsim/Arraymancer/blob/61188413abb269471ff5cbf4b9326ddd3c2a38c7/src/arraymancer/linear_algebra/helpers/solve_lapack.nim#L14
15:11:28*cuibonobo joined #nim
15:23:39*Zevv quit (Ping timeout: 256 seconds)
15:34:08*Zevv joined #nim
15:36:16FromDiscord<Patitotective> Does someone have an example of a parser package parsing json? I've this parser https://github.com/chocobo333/mcmurry but it only have an example of a calculator and `std/parsejson` is raw, and complex
15:36:24FromDiscord<Patitotective> (edit) "Does someone have an example of a parser package parsing json? I've ... this" added "found"
15:37:07FromDiscord<Patitotective> _honeycomb_'s example is also a calculator
15:37:13FromDiscord<Patitotective> 😕
15:37:28FromDiscord<Patitotective> (edit) "a calculator" => "simple"
15:38:53FromDiscord<Patitotective> _nimly_'s example is also a calculator
15:42:01FromDiscord<eyecon> Do you really need to reimplement JSON parsing though? There are so many JSON parsers, I thought
15:42:07FromDiscord<eyecon> Or is this a learning project
15:42:13FromDiscord<eyecon> In which case more power to you
15:42:24FromDiscord<Patitotective> i want to parse a syntax similar to json
15:42:35FromDiscord<Patitotective> https://patitotective.github.io/PREFS/
15:43:02FromDiscord<Patitotective> (edit) "https://patitotective.github.io/PREFS/" => "sent a code paste, see https://play.nim-lang.org/#ix=3LZS"
15:43:06FromDiscord<Rika> ah were back to this again
15:43:09FromDiscord<Patitotective> hehe
15:43:09FromDiscord<Rika> i forgot youre that guy
15:43:35FromDiscord<Rika> imo
15:43:45FromDiscord<Rika> i would just "make my own examples"
15:43:49FromDiscord<eyecon> Well, I assume you know how to parse the atoms, the complicated part is the recursion
15:44:00FromDiscord<Rika> not really i dont think
15:44:12FromDiscord<Patitotective> i dont know which parser to use
15:44:18FromDiscord<Rika> wdym?
15:44:27FromDiscord<Patitotective> like, a parser library
15:44:32FromDiscord<Rika> ah
15:44:37FromDiscord<mratsim> In reply to @Patitotective "Does someone have an": jsony, nim-json-serialization, .... there are like 7 or so
15:45:11FromDiscord<Rika> i really like status' serialisation lib, dunno why people arent using it that much
15:45:29FromDiscord<eyecon> I would just use CBOR for everything if it were up to me
15:45:33FromDiscord<eyecon> Compact and well-defined
15:45:42FromDiscord<Rika> cbor is a binary format
15:45:48FromDiscord<Rika> i assume he wants it to be readable
15:45:52FromDiscord<Patitotective> yea
15:45:53FromDiscord<mratsim> there is a chronos dependencies because we need it for testing and we don't have test-only / optional dependencies in nimble :/
15:45:55FromDiscord<Rika> in which case why invent a new format?
15:45:58FromDiscord<Rika> just use json....
15:46:07FromDiscord<mratsim> (edit) "dependencies" => "dependency"
15:46:11FromDiscord<Rika> In reply to @mratsim "there is a chronos": ah i see
15:46:20FromDiscord<Patitotective> In reply to @Rika "just use json....": that's not the idea ._.
15:46:26FromDiscord<Rika> im just sayin
15:46:55FromDiscord<Patitotective> back to my question, which parser should I use?
15:47:00FromDiscord<Patitotective> (edit) "back to my question, which parser ... should" added "library"
15:47:11FromDiscord<mratsim> what constraints do you have?
15:47:12FromDiscord<Rika> if you want you can start with a peg
15:47:15FromDiscord<eyecon> Do you have a specific reason to implement your own (citing Greenspun) half-assed implementation of half the JSON?
15:47:18FromDiscord<Rika> in which case id use npeg
15:47:28FromDiscord<mratsim> In reply to @eyecon "Do you have a": Isn't it about Lisp though?
15:47:44FromDiscord<Patitotective> In reply to @mratsim "what constraints do you": huh?
15:47:53FromDiscord<eyecon> In reply to @mratsim "Isn't it about Lisp": It is but I have to think of this every time I hear of a new configuration format nowadays
15:48:01*Zevv quit (Ping timeout: 256 seconds)
15:48:13FromDiscord<eyecon> The idea is the same
15:48:21FromDiscord<mratsim> In reply to @Patitotective "huh?": well what development constraint and design constraint do you have?
15:48:27FromDiscord<Rika> In reply to @Patitotective "huh?": its a kinda-difficult question, probably about what kind of language it is in the chomsky hierarchy to be able to choose which type of parser
15:48:30FromDiscord<Rika> ah
15:48:35FromDiscord<Rika> misinterpretation galore
15:48:36FromDiscord<eyecon> Every human-readable declarative configuration language converges to one of JSON, YAML or TOML
15:49:31*Zevv joined #nim
15:49:43FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3LZT
15:49:56FromDiscord<Rika> In reply to @eyecon "Every human-readable declarative configuration": i'd wish someone made an ultra-YATOJSONML that combined each's benefits
15:50:09FromDiscord<mratsim> There are way more but see the many json read/writer: https://github.com/treeform/jsony/blob/master/tests/bench.nim#L2-L10
15:50:28FromDiscord<Rika> lmfao tha reaction
15:50:39FromDiscord<mratsim> jsony, jason, eminim, packedjson, json-serialization, json
15:51:56FromDiscord<mratsim> if you want to code-gold on loc, I guess npeg.
15:52:02FromDiscord<mratsim> code-golf
15:52:17FromDiscord<Patitotective> ill try npeg
15:52:18FromDiscord<Patitotective> thanks
15:52:20FromDiscord<Patitotective> 🙃
15:54:08FromDiscord<mratsim> there is a json parser in the tests if you want to use that as a reference
15:54:49FromDiscord<mratsim> https://github.com/zevv/npeg/blob/master/tests/examples.nim#L85-L107
16:06:38FromDiscord<auxym> json sort of sucks for human-writeable config though, cause no comments and no trailing commas
16:07:49FromDiscord<auxym> plain old ini, json5, toml or kdl are probably the best for that IMO. (yaml has... issues)
16:08:04FromDiscord<eyecon> I root for TOML
16:08:06FromDiscord<eyecon> FWIW
16:08:21FromDiscord<eyecon> Nice, intuitive, relatively capable
16:10:38FromDiscord<auxym> agreed. toml's biggest disadvantage is probably deeply nested structures, but that should hopefully not come up for the "human writeable config" usecase (or you have bigger issues)
16:14:50FromDiscord<Rika> same here
16:15:07FromDiscord<Rika> config should probably be max. 3 depth
16:15:19FromDiscord<Rika> and 3 is already kinda pushing it
16:15:22FromDiscord<Rika> so not much of an issue id say
16:35:55*rockcavera quit (Remote host closed the connection)
16:38:35*yann-kaelig left #nim (#nim)
16:43:46*rockcavera joined #nim
16:43:46*rockcavera quit (Changing host)
16:43:46*rockcavera joined #nim
16:50:07FromDiscord<IsaacPaul> big fan of json5 here. Simple and explicit.
16:52:56*jjido joined #nim
17:02:46FromDiscord<Patitotective> Can Nim `char`s be defined like `Print <- {'\x21'..'\x7e',' '}, # Visible characters and spaces`?↵(npeg)
17:04:09FromDiscord<Patitotective> is there a place where i could see how nim type's grammar is defined?
17:04:34FromDiscord<Patitotective> like this https://nim-lang.org/docs/manual.html#syntax-grammar↵but for types
17:16:47FromDiscord<mratsim> In reply to @Patitotective "Can Nim `char`s be": Nim char are 0..255
17:16:50*stkrdknmibalz joined #nim
17:16:52FromDiscord<mratsim> the same as C
17:17:15FromDiscord<hmmm> uh oh, I forgot again how to zip two seqs into a std table, halp pls 😑
17:17:40FromDiscord<mratsim> In reply to @hmmm "uh oh, I forgot": import sequtils?
17:17:44FromDiscord<hmmm> oh
17:17:59FromDiscord<hmmm> I don't think I did it with sequtils when I did it the last time
17:21:01FromDiscord<hmmm> oh yea I used zip, ty miri
17:21:52FromDiscord<Rika> miri?
17:22:15FromDiscord<hmmm> 😅
17:50:40*noeontheend joined #nim
18:17:09FromDiscord<yallxe> hi, how do I compile nim application without any console/window?
18:20:29FromDiscord<Rika> --app:gui? not sure
18:35:15*Lord_Nightmare quit (*.net *.split)
18:35:16*cyraxjoe quit (*.net *.split)
18:35:16*oprypin quit (*.net *.split)
18:35:16*cornfeedhobo quit (*.net *.split)
18:35:16*ldlework quit (*.net *.split)
18:35:17*dv2 quit (*.net *.split)
18:35:17*oisota quit (*.net *.split)
18:35:17*LyndsySimon quit (*.net *.split)
18:35:18*termer quit (*.net *.split)
18:35:18*Amun-Ra quit (*.net *.split)
18:35:18*euantorano quit (*.net *.split)
18:35:18*Ekho quit (*.net *.split)
18:35:19*anadahz quit (*.net *.split)
18:35:19*Goodbye_Vincent quit (*.net *.split)
18:35:19*mahlon quit (*.net *.split)
18:35:20*GnuYawk quit (*.net *.split)
18:35:20*ecs quit (*.net *.split)
18:35:20*[R] quit (*.net *.split)
18:35:21*xiamx quit (*.net *.split)
18:35:22*robertmeta quit (*.net *.split)
18:35:22*stkrdknmibalz quit (*.net *.split)
18:35:22*rockcavera quit (*.net *.split)
18:35:23*neurocyte09170 quit (*.net *.split)
18:35:24*vicecea quit (*.net *.split)
18:35:24*rb quit (*.net *.split)
18:35:25*jkl1337 quit (*.net *.split)
18:35:26*happycorsair[m] quit (*.net *.split)
18:35:26*xiamx[m] quit (*.net *.split)
18:35:26*averell quit (*.net *.split)
18:35:27*meowray quit (*.net *.split)
18:35:29*toothlessgear quit (*.net *.split)
18:35:29*blackbeard420 quit (*.net *.split)
18:35:30*zgasma[m] quit (*.net *.split)
18:35:30*xet7 quit (*.net *.split)
18:35:30*dtomato quit (*.net *.split)
18:35:31*redj quit (*.net *.split)
18:35:31*GreaseMonkey quit (*.net *.split)
18:35:31*koltrast quit (*.net *.split)
18:35:32*dom96 quit (*.net *.split)
18:35:32*adium quit (*.net *.split)
18:35:33*FromDiscord quit (*.net *.split)
18:35:33*mal`` quit (*.net *.split)
18:35:33*mjsir911 quit (*.net *.split)
18:35:34*ormiret quit (*.net *.split)
18:35:34*Yardanico quit (*.net *.split)
18:35:34*NimEventer quit (*.net *.split)
18:35:34*jjido quit (*.net *.split)
18:35:34*Zevv quit (*.net *.split)
18:35:34*fvs quit (*.net *.split)
18:35:35*nixfreaknim[m] quit (*.net *.split)
18:35:35*cheer[m] quit (*.net *.split)
18:35:35*notchris quit (*.net *.split)
18:35:35*Schnouki quit (*.net *.split)
18:35:36*gshumway quit (*.net *.split)
18:35:36*madprops quit (*.net *.split)
18:35:36*djanatyn quit (*.net *.split)
18:35:37*sagax quit (*.net *.split)
18:35:37*vicfred quit (*.net *.split)
18:35:38*anddam quit (*.net *.split)
18:35:38*kayabaNerve_ quit (*.net *.split)
18:35:38*joast quit (*.net *.split)
18:35:39*ozzz quit (*.net *.split)
18:35:39*ehmry quit (*.net *.split)
18:35:39*Onionhammer quit (*.net *.split)
18:35:39*oddish quit (*.net *.split)
18:38:44*noeontheend quit (Ping timeout: 256 seconds)
18:39:52*oprypin_ joined #nim
18:39:52*MightyJoe joined #nim
18:39:52*hexeme joined #nim
18:39:52*Lord_Nightmare joined #nim
18:39:52*termer_ joined #nim
18:39:52*LyndsySimon joined #nim
18:39:52*euantorano joined #nim
18:39:52*oisota joined #nim
18:39:52*stkrdknmibalz joined #nim
18:39:52*jjido joined #nim
18:39:52*rockcavera joined #nim
18:39:52*Zevv joined #nim
18:39:52*neurocyte09170 joined #nim
18:39:52*fvs joined #nim
18:39:52*sagax joined #nim
18:39:52*vicfred joined #nim
18:39:52*anddam joined #nim
18:39:52*vicecea joined #nim
18:39:52*kayabaNerve_ joined #nim
18:39:52*anadahz joined #nim
18:39:52*joast joined #nim
18:39:52*zgasma[m] joined #nim
18:39:52*nixfreaknim[m] joined #nim
18:39:52*xiamx joined #nim
18:39:52*happycorsair[m] joined #nim
18:39:52*cheer[m] joined #nim
18:39:52*xiamx[m] joined #nim
18:39:52*jkl1337 joined #nim
18:39:52*rb joined #nim
18:39:52*[R] joined #nim
18:39:52*ecs joined #nim
18:39:52*GnuYawk joined #nim
18:39:52*mahlon joined #nim
18:39:52*Goodbye_Vincent joined #nim
18:39:52*robertmeta joined #nim
18:39:52*meowray joined #nim
18:39:52*averell joined #nim
18:39:52*blackbeard420 joined #nim
18:39:52*toothlessgear joined #nim
18:39:52*NimEventer joined #nim
18:39:52*Yardanico joined #nim
18:39:52*ormiret joined #nim
18:39:52*mjsir911 joined #nim
18:39:52*mal`` joined #nim
18:39:52*FromDiscord joined #nim
18:39:52*koltrast joined #nim
18:39:52*GreaseMonkey joined #nim
18:39:52*redj joined #nim
18:39:52*dtomato joined #nim
18:39:52*xet7 joined #nim
18:39:52*adium joined #nim
18:39:52*dom96 joined #nim
18:39:52*djanatyn joined #nim
18:39:52*madprops joined #nim
18:39:52*Schnouki joined #nim
18:39:52*notchris joined #nim
18:39:52*gshumway joined #nim
18:39:52*oddish joined #nim
18:39:52*Onionhammer joined #nim
18:39:52*ehmry joined #nim
18:39:52*ozzz joined #nim
18:40:32FromDiscord<yallxe> In reply to @Rika "--app:gui should disable the": works! what about `echo`? will it just ignore all the `echo` statements?
18:40:33FromDiscord<Rika> no it still runs, its just "hidden"
18:40:33FromDiscord<Rika> afaik
18:42:22*Amun-Ra joined #nim
18:44:40*Ekho- joined #nim
18:45:30*cornfeedhobo joined #nim
19:33:47FromDiscord<Patitotective> In reply to @mratsim "Nim char are 0..255": 0..255?
19:39:32nrds<Prestige99> a range from 0 to 255
19:41:22FromDiscord<demotomohiro> !eval echo char.low, ",", char.high
19:41:24NimBot,�
19:41:29Amun-Rathe difference is 'a' in nim is char, 'a' in C is int
19:42:38FromDiscord<el__maco> its not
19:42:54Amun-Rahm?
19:42:56FromDiscord<el__maco> I mean in C 'a' is char
19:42:57*joshbaptiste quit (Ping timeout: 240 seconds)
19:42:59FromDiscord<Patitotective> and strings are just a chain of chars? or do they have a different range
19:43:13Amun-Rael__maco: nope, check the standard
19:43:40FromDiscord<el__maco> In reply to @Amun-Ra "<@266582742307700737>: nope, check the": https://en.cppreference.com/w/cpp/language/character_literal
19:43:55FromDiscord<el__maco> that's c++ but I'm not sure C is any different
19:44:12Amun-Rael__maco: yes, it's char in C++
19:44:16FromDiscord<el__maco> at some point the standard has been in my head but I have forgotten most of it
19:44:54FromDiscord<xx_ns> @yallxe I hope whatever you're writing is legal
19:44:54Amun-Rain C, character literals are ints
19:45:12FromDiscord<xx_ns> or, rather, used in a legal way
19:46:55Amun-Rael__maco: C99, 6.4.4.4p10 "An integer character constant has type int"
19:48:23FromDiscord<el__maco> I see. It seems to be even in C89
19:48:37Amun-Rayes
19:49:00Amun-Rait predates ansic c, k&r had that too
19:49:18FromDiscord<el__maco> I guess it makes some sense, since the integer promotion takes place and the original C doesn't have many situation where that would make a difference?
19:50:58FromDiscord<el__maco> (edit) "I guess it makes some sense, since the integer promotion takes place ... andsituations" added "anyways" | "situation where that" => "situations in which having a char literal" | "difference?" => "difference 🤔"
19:51:37Amun-Ramhm
19:52:08FromDiscord<el__maco> apparently nim chars are unsigned however, most C compilers provide signed chars by default
19:52:58Amun-Raand again, default sigedness in C char is… weird ;>
19:53:32FromDiscord<el__maco> it is, a bit
19:53:35Amun-Ra(it's implementation defined)
19:53:51FromDiscord<el__maco> I guess its in some ways consistent, since all other integer types are signed by default
20:06:19FromDiscord<Ksr> Are `typedesc[Type]` and `type Type` the same in proc signatures?
20:06:57FromDiscord<Ksr> I could not find any thing on `type Type` in proc signatures in the docu.
20:07:04FromDiscord<Ksr> (edit) removed "" | "any thing" => "anything"
20:10:52*neurocyte091707 joined #nim
20:12:39*neurocyte09170 quit (Ping timeout: 256 seconds)
20:12:39*neurocyte091707 is now known as neurocyte09170
20:12:41*krux02 joined #nim
20:20:46FromDiscord<yallxe> In reply to @xx_ns "<@336955873790525441> I hope whatever": its not, but used in legal way
20:21:35FromDiscord<yallxe> im not gonna distribute it
20:21:44FromDiscord<xx_ns> In reply to @yallxe "its not, but used": elaborate?
20:23:14FromDiscord<yallxe> ?
20:24:20FromDiscord<xx_ns> what do you mean by what you said
20:24:55FromDiscord<yallxe> im writing a malware but using in educational purposes and not distributing it
20:25:05FromDiscord<xx_ns> it's not illegal to write malware, its use and specifically who you're targeting is what would make it illegal
20:25:08FromDiscord<xx_ns> okay
20:26:14FromDiscord<xx_ns> if i may ask, what are these educational purposes?
20:26:29FromDiscord<xx_ns> it's easy to say that
20:27:13FromDiscord<xx_ns> not that I'm accusing you of anything, but I think most people would feel easier helping you overall if they knew what it exactly is you're doing
20:27:20FromDiscord<yallxe> treat it as a research
20:27:59FromDiscord<yallxe> i mean i try to reverse some shitty antiviruses
20:28:53FromDiscord<yallxe> pls pm me if you want to ask something
20:42:31FromDiscord<deech> How do I convert a string to a `typedesc` at compile time? eg. if I have some type `MyType` , I would like to be pass it as a string, convert that string to a typedesc and do various operations like `getTypeImpl` or whatever ...
20:43:18FromDiscord<leorize> `bindSym`
20:45:10FromDiscord<deech> Thanks!
20:45:58FromDiscord<deech> Why doesn't `ident("MyType")` work?
20:49:22krux02deech: don't typedesc
20:50:05krux02ident"MyType" should work, if the type is in scope (a known identifier for the compiler) in the context where the macro is expanded
20:51:30FromDiscord<Elegantbeef> bindsym will only work if the symbol is on the scope of macro
20:54:55FromDiscord<deech> sent a code paste, see https://play.nim-lang.org/#ix=3M1a
20:58:07FromDiscord<Elegantbeef> Yea `bindsym` will find the symbol(s) in the scope and give you a `symbol`
20:58:25FromDiscord<Elegantbeef> anything that relies on type information needs to be typed which means you need symbols
20:58:38FromDiscord<deech> Awesome, does that work with imported symbols as well?
20:58:58FromDiscord<Elegantbeef> `ident` is just "fancy string" it's an non typed symbol
20:59:34FromDiscord<Patitotective> Does _npeg_ supports indentation? Or do I need to create my own system?
20:59:37FromDiscord<Elegantbeef> Any symbol in scope
21:00:25FromDiscord<Elegantbeef> Nim macros can go pretty deep to get whatever information you need
21:01:03FromDiscord<Elegantbeef> Npeg is pattern matching so wouldnt indention be apart of the pattern?
21:01:42*rockcavera quit (Remote host closed the connection)
21:02:28FromDiscord<Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3M1c
21:03:59arkanoidPMunch: I'm back on the SIGSEGV problem
21:04:03FromDiscord<Elegantbeef> I've never used npeg so i dont know what it can do
21:04:07FromDiscord<Elegantbeef> It's all magic to me
21:04:53arkanoidPMunch: but this time with libclang-10 debug symbols
21:05:24arkanoidsigsegv is in #0 clang_getTranslationUnitCursor () at /build/llvm-toolchain-10-yegZYJ/llvm-toolchain-10-10.0.0/clang/tools/libclang/CIndex.cpp:4208
21:07:19FromDiscord<Patitotective> Also, if I were going to convert https://github.com/zevv/npeg/blob/master/tests/examples.nim#L58 into an actual json parser (that outputs a `JsonNode`) how could I difference when some `JSON` rule matched a `jnumber` or a `jobject`?↵Doing `JSON <- ?S ( >jnumber | >jobject | >jarray | >jstring | >jtrue | >jfalse | >jnull ) ?S` doesn't let me difference between the matched value
21:07:40FromDiscord<Patitotective> (edit) "when" => "if"
21:09:56Zevvit can do indentation, but it's not trivial
21:10:16Zevvlook at https://github.com/zevv/npeg/blob/master/misc/indent.nim for inspiration
21:10:31Zevvyou need to do some bookkeeping yourself
21:11:44*Ekho- is now known as Ekho
21:12:02Zevvalso, that json parser only matches and parsers, but does not build a jsonnode ast
21:13:07FromDiscord<Patitotective> In reply to @Zevv "also, that json parser": yes i know, i was asking for how to know which rule some rule matched
21:14:04Zevvyou could put capture operators on the individual rules and add nim code that executes when the rule matches
21:14:54FromDiscord<Patitotective> does the define order of the rules matter?
21:14:57Zevvhere is an example that does some real world AST building for an early generation of the Rod languge: https://github.com/zevv/npeg/blob/master/misc/rod.nim
21:15:01*Gustavo6046 joined #nim
21:15:09Zevvorder does not change functionality, but it affects generated code size and performance
21:15:33Zevvrule A depends on rule B: if you define B before A it gets inlined, otherwise it gets called
21:15:41Zevvcalls have some overhead, but generate smaller parsers
21:15:55Zevvsee https://github.com/zevv/npeg#grammars
21:16:05FromDiscord<Patitotective> my parser does create a table and the keys are matched first so i would need to store keys and values in sequences to then convert them into a table (?)
21:16:29Zevvthat would work, yes
21:17:07ZevvI typically store captures on a stack, and then put pieces of nim code in the grammar that take the last few matches from the stack to perform some operation on them, like putting them in a map or in some AST data structure
21:17:26Zevvthe rod example does that
21:18:06FromDiscord<Patitotective> In reply to @Zevv "that would work, yes": but is it efficient?
21:18:50*Guest14 joined #nim
21:18:50Guest14hey
21:19:05*Guest14 quit (Client Quit)
21:21:33ZevvI do not see how it is not sufficient
21:21:42Zevvyou get your captures in the order as they appear in the subject string
21:21:58Zevvyou need to store them somewhere until you have all the parts complete to build your particular bit of AST
21:22:18Zevvas you want this to be recursive safe, you cant just store them in a var, so a stack is a natural fit
21:23:05Zevvif you super care about efficiency, you probably want to build a recursive descent or something similar by hand
21:23:15Zevvyou get twice at fast, probably
21:23:26FromDiscord<SecureThisShit> sent a long message, see http://ix.io/3M1j
21:25:12FromDiscord<treeform> so strings can always be cased to seq[byte]
21:25:28FromDiscord<treeform> writeFile(string, cast[string](bytes))
21:25:30FromDiscord<treeform> should work
21:25:33Zevvin the current implementation of nim, that is
21:25:41FromDiscord<treeform> yes
21:25:44Zevvthere are no guarentees this will always work in the future
21:25:50FromDiscord<treeform> I rely on this quite heavily though
21:25:57Zevvwe all make mistakes, right
21:26:11FromDiscord<SecureThisShit> I tried converting to a string and writing to a file. But I couldn't get the same bytes back when reading the file.
21:26:20FromDiscord<SecureThisShit> So something seams to convert wrong.
21:26:41FromDiscord<treeform> make a simple test case, verify it
21:27:29FromDiscord<treeform> once the seq[byte] to string breaks my tests will tell me right away and I will complain
21:29:43*rockcavera joined #nim
21:29:44*rockcavera quit (Changing host)
21:29:44*rockcavera joined #nim
21:31:01FromDiscord<Elegantbeef> There is and will be `toOpenArrayByte` in the future, so that's a possible avenue
21:38:57FromDiscord<leorize> how come `seq[byte]` doesn't match into an `openArray[byte]`?
21:39:18FromDiscord<SecureThisShit> I got it to work via casting to string now.
21:39:25FromDiscord<SecureThisShit> Seamed to be an layer 8 issue before 😛
21:40:14FromDiscord<Isofruit> Man, I had this halfway epic written
21:40:27FromDiscord<Isofruit> And then I realized the answer to my problem was, that what I was trying to do needs macros
21:40:33FromDiscord<Isofruit> And I don't think the easy kind either
21:41:41FromDiscord<treeform> if you can solve problem without macros you should
21:42:07FromDiscord<treeform> but if you are echo ing out nim code to compile leter... macros are probably better?
21:42:10FromDiscord<Isofruit> I don't think I can, at least not without a performance penalty by moving a calculation to runtime that imo I should be performing at compile time
21:42:12FromDiscord<hmmm> is there a macro of the easy kind? 🤔
21:42:25FromDiscord<treeform> yes its called a `template`
21:43:08FromDiscord<Isofruit> Beef demonstrated a somewhat simple one that helps unpack type A from within type B like this(https://play.nim-lang.org/#ix=3M1h), it's pretty nifty and not toooooo crazy
21:43:11FromDiscord<Isofruit> Though still dark magic
21:43:35FromDiscord<treeform> beefmagic
21:43:57FromDiscord<hmmm> yea def too much beefwizardry there
21:44:40FromDiscord<hmmm> I'd like to see a macro do var x = 42 just to see if I can grasp it lol
21:45:58FromDiscord<treeform> that macro is like 1 line?
21:46:19FromDiscord<hmmm> the best kind then 😃
21:48:38FromDiscord<Isofruit> sent a long message, see http://ix.io/3M1m
21:49:16FromDiscord<Isofruit> So the entire part of "figure out the foreign key field names for the query and the unpacking-macro" I wanted to move to compile time as much as possible
21:49:29FromDiscord<Isofruit> (edit) "unpacking-macro"" => "unpacking-macro from the type-definitions""
21:51:01FromDiscord<Isofruit> Currently I have a proc for that with a lot of when statements to figure that out, but it doesn't really act at compile time because it uses a lot of functions from norm (https://play.nim-lang.org/#ix=3M1l)
21:51:41FromDiscord<Isofruit> The only way for me to actually do all of that "figure out the field name for me" stuff at compile time is macros I think
21:52:24FromDiscord<hmmm> I'm eyeballing you will need a macro for every time you said "figure out" 😃
21:52:27FromDiscord<Isofruit> (edit) "for me"" => "on type A that points to type B""
21:53:06FromDiscord<Isofruit> ~~I just really do not want to write out this stuff every time I have a many to many relationship~~
21:53:31FromDiscord<Isofruit> Which, I will admit, I have in my own application like... maybe 8 or so of
21:53:37FromDiscord<Isofruit> (edit) "Which, I will admit, I have in my own application ... like..." added "only"
21:53:43FromDiscord<Isofruit> But still!
21:58:13FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3M1p
21:58:34FromDiscord<Isofruit> In reply to @hmmm "I'm eyeballing you will": That's actually only a single macro, one that eats 2 Model-types and spits out their related field as a static string if there is one
21:59:52FromDiscord<Isofruit> But writing that functionality as a proc was already hard enough because there's a lot of ways to have field X be an FK to another Model (like 4 strictly speaking, though 2 are identified though the same way, so more like 3)
22:00:23FromDiscord<Isofruit> (edit) "But writing that functionality as a proc ... was" added "that runs partially at runtime"
22:00:39FromDiscord<Isofruit> (edit) "FK" => "FK-Field"
22:02:10FromDiscord<Isofruit> I guess in the end it doesn't matter too much... whatever performance penalty this has pales in comparison to a db query... still grinds my gears though
22:19:32*oprypin_ quit (Ping timeout: 240 seconds)
22:21:07*oprypin joined #nim
22:22:28FromDiscord<Isofruit> Wait, I'm an idiot, of course my code wouldn't compile, I tried to assign a static string that only exists at compile time to a let expression in a proc that acts at runtime
22:23:07FromDiscord<Elegantbeef> Not certainly impossible↵(@Isofruit)
22:23:51FromDiscord<Isofruit> Hmmm whenever I tried to use my "getRelatedFieldNameOn" to give me a compile-time-static-string and tried to assign that to a var, my compiler exploded
22:24:09FromDiscord<Isofruit> Let me whip up an example
22:36:24*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
22:37:13*jjido joined #nim
22:41:05FromDiscord<Isofruit> https://play.nim-lang.org/#ix=3M1A
22:42:21FromDiscord<hmmm> after dabbling with the manual I made my first macro 😃 https://play.nim-lang.org/#ix=3M1z
22:42:29FromDiscord<Isofruit> I can use the `mapModel` macro, which takes a static string, only when I pass in `A.getRelatedFieldNameOn(B)` directly in into the macro call.↵The moment I try `let s: static string = A.getRelatedFieldNameOn(B)`, I get compiler complaining. If I leave out the type annotation, I think it turns the static string into a normal string and I can't use it with the macro anymore
22:43:36FromDiscord<hmmm> still I don`t get what is the nnk thingy supposed to be. Manual just says it"s appropriate for the debug macro
22:44:45FromDiscord<Isofruit> I can tell you that `nnkDotExpr.newTree(ident"it", ident field)` is the equivalent of `it.walumba` if `field` contains the string `"walumba"`
22:45:14FromDiscord<Isofruit> So if nnkDotExpr is like `.` ... nnk maybe is just a general prefix for dark compiler magic macros?
22:45:17FromDiscord<Isofruit> (edit) "macros?" => "macro stuff?"
22:47:22FromDiscord<hmmm> hmm let's wait for the beefy lectures "on demystifying macros and other fun stuff to do at compile time"
22:48:01FromDiscord<Isofruit> I swear I'll read that article, I actually don't want to get into macros _yet_ , but my web project just kinda forces my hand there
22:48:07FromDiscord<Isofruit> (edit) "I swear I'll read that article, I ... actually" added "just"
22:55:46*PMunch quit (Quit: leaving)
22:56:44FromDiscord<Elegantbeef> do `let s = static: A.getRelatedFieldNameOn(B)`
22:57:23FromDiscord<Elegantbeef> you have a proc that can only be used at compile time but you want to use it to set a let, you need the `static` to make it so Nim knows "hey call this at compile time and insert the result here"
22:58:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3M1C
22:58:32FromDiscord<Elegantbeef> nnkDotExpr is just an enum↵(@Isofruit)
22:59:03FromDiscord<Elegantbeef> I'd have answered sooner but i went for a walk since it's finally a warm 4c out and my dogs havent walked for a month or so
22:59:29FromDiscord<Isofruit> Perfectly fine, I took forever to post my example as well and I'm just thankful you're answering either way!
22:59:58FromDiscord<Elegantbeef> You dont need the `nnkStmtList` you can just do `newCall("echo", x)`↵(@hmmm)
23:00:20FromDiscord<Elegantbeef> Also there is a `newStmtList()` procedure which takes a varargs[NimNodes]
23:02:16FromDiscord<Isofruit> In reply to @Elegantbeef "you have a proc": So I don't prefix the type with `static`to signal it exists at compile time, I prefix the `proc` to tell it to run that at compile time, ahhhh
23:02:45FromDiscord<Elegantbeef> Well something that returns `static string` means it runs at compileTime only↵(@Isofruit)
23:03:02FromDiscord<Elegantbeef> It's implicit compile time only
23:03:44FromDiscord<hmmm> beef are the examples in the macro section of the manual working implementations in real nim? Things like "withfile", "items", "enumerate". If so, consider my mind blown
23:03:51FromDiscord<Elegantbeef> So if it runs at CT only and you attempt to assign it to let you need to say "Yes i want this to run at compile time"
23:04:39FromDiscord<Elegantbeef> Why would they show impossible examples
23:05:02*koltrast quit (Ping timeout: 240 seconds)
23:05:33*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:05:34FromDiscord<hmmm> but they are used in that form in nim? they seem far too simple 🤔
23:06:15FromDiscord<hmmm> still, impressive stuff
23:06:20FromDiscord<Elegantbeef> What do you mean?
23:06:41FromDiscord<Elegantbeef> Templates are by definition code substitution
23:07:05FromDiscord<Elegantbeef> So there is no introspection it's just paste expanded code here
23:07:32FromDiscord<hmmm> for some reason I always tought thare was some sort of complex machinery behind some magic keyword I use daily lol
23:07:48*Mister_Magister joined #nim
23:07:54FromDiscord<Elegantbeef> Well builtins have magic behind them
23:08:04FromDiscord<Elegantbeef> https://github.com/beef331/constructor/blob/master/src/constructor/constructor.nim here is a relatively simple macro
23:08:33FromDiscord<Isofruit> Just ran it on play.nim-lang, I think it still explodes. https://play.nim-lang.org/#ix=3M1E
23:08:43Mister_MagisterHi, i'm trying to use nimscript to run a command and get it's output but when i try to run execProcess i get undeclared indentifier so i import std/os or std/osproc but then i get cannot 'importc' variable at compile time
23:09:01FromDiscord<Elegantbeef> that takes a `proc init(_: typedesc[MyType], args: int): MyType = discard` and turns it into `proc init(_: typedesc[MyType], args: int) : MyType = MyType(args: args)`
23:09:42FromDiscord<Elegantbeef> Oh yea that wont work
23:09:47FromDiscord<Elegantbeef> change it to `const`
23:09:58FromDiscord<Isofruit> Ohhhhh , allow me to faceplant
23:10:05FromDiscord<Isofruit> Dangit, I know of const
23:10:10FromDiscord<Elegantbeef> `mapModel` is a macro which needs compile time values
23:10:16FromDiscord<Elegantbeef> I didnt realize that was the issue
23:10:28FromDiscord<Elegantbeef> didnt know the playground had the modules so just guessed the issue
23:10:54FromDiscord<mratsim> In reply to @treeform "writeFile(string, cast[string](bytes))": don't do that, string needs to end with nul byte which the cast doesn't guarantee
23:11:03FromDiscord<Elegantbeef> In a nimscript module it's just `exec`
23:11:47FromDiscord<Isofruit> Yeah, don't even need the static, nim knows through const automatically that stuff needs to run at compile time
23:12:20FromDiscord<Elegantbeef> Mratsim does that need to end with \\
23:12:24FromDiscord<Elegantbeef> '\\0\`?
23:12:33FromDiscord<Elegantbeef> Since it's a file IO operation
23:12:49FromDiscord<Elegantbeef> You could have a '\\0' anywhere in the data
23:12:56FromDiscord<mratsim> In reply to @Isofruit "So if nnkDotExpr is": nnk is nim node kind
23:13:13Mister_Magisterhmmm i don't think its doable
23:13:40FromDiscord<Elegantbeef> It's just `exec`
23:13:47Mister_Magisteryeah and exec doesn't give output
23:14:07FromDiscord<mratsim> In reply to @Elegantbeef "You could have a": EOF is sometimes \0, for example when reading from stdin
23:14:44FromDiscord<Isofruit> In reply to @mratsim "nnk is nim node": Ahhhh, thanks for clearing that up!
23:14:53FromDiscord<mratsim> and since it's file IO, the copy is basically costless compared to the IO
23:15:08FromDiscord<mratsim> and there is a writeBytes proc anyway iirc
23:15:25FromDiscord<Elegantbeef> Yea was going to say eitherway you can just write the bytes
23:15:30FromDiscord<mratsim> or you open as stream and write to it
23:16:34FromDiscord<Elegantbeef> You can use `gorgeEx` mister\_magister
23:16:40FromDiscord<Elegantbeef> or `gorge`
23:17:54FromDiscord<mratsim> for example here I had to use C EOF instead of Nim's not sure why https://github.com/mratsim/trace-of-radiance/blob/master/trace_of_radiance/io/h264.nim#L278
23:18:51FromDiscord<mratsim> (yes you can do a H264 encoder in 250 lines)
23:21:10FromDiscord<Elegantbeef> `endOfFile` doesnt work either?
23:21:41FromDiscord<Elegantbeef> `return c < 0'i32` if not i think it's this
23:23:15FromDiscord<mratsim> I tried the Nim one in std/io, it hanged iirx
23:23:20FromDiscord<mratsim> (edit) "iirx" => "iirc"
23:24:07FromDiscord<Elegantbeef> If it hung it's probably due to that check being `<0` and not `<=` but i dont know
23:25:42FromDiscord<Elegantbeef> I dont know if you seen my response but the issue for your staccato example is due to this line https://github.com/mratsim/weave/blob/a2e118b36373d61346d7443f9f345b808501cf66/experiments/e01_staccato/task_worker.nim#L27 unrelated to the `FibTask` really
23:26:29FromDiscord<Elegantbeef> Nim's generic cannot handle a `T or var T` so it cries at attempting to generate the code
23:26:58FromDiscord<mratsim> ah good catch
23:27:46FromDiscord<Elegantbeef> Removing that the error goes away but then there are symbol issues that appear
23:27:53FromDiscord<Elegantbeef> Namely that it cannot get `t.child`
23:29:09FromDiscord<mratsim> well that was trying to explore multithreading runtime before I wrote the Picasso/Weave RFC
23:29:40*jjido joined #nim
23:30:37FromDiscord<mratsim> it was one of the most C++ runtimes thanks to their decision to stack allocate everything (at unfortunately the cost that not all code could be parallelizable)
23:30:45FromDiscord<Elegantbeef> Of course if you want the abillity to have `T or var T` you need to either discriminate it statically or with an object variant 😀
23:30:58FromDiscord<mratsim> (because you needed to know the "fork factor" of each task
23:31:46FromDiscord<Elegantbeef> Yea i noticed it was 2 years old, was interested if my fixes to recursive generics changed it, cause i cannot read what sixte wrote
23:32:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3M1J
23:33:31FromDiscord<mratsim> ah the joy of `when` in a typesection
23:33:42FromDiscord<Elegantbeef> Indeed
23:33:51FromDiscord<Elegantbeef> Atleast it doesnt destroy type intropsective macros
23:33:52FromDiscord<mratsim> I don't miss fighting to have that working
23:34:21FromDiscord<mratsim> still is broken in some very annoying ways
23:34:25FromDiscord<Elegantbeef> to be fair though your example code was a generic with 0 way to resolve which
23:35:29FromDiscord<FractalCycle> installation zip on nim-lang.org seems broken, just me?
23:35:45Mister_Magistercan i concat two arrays into pairs?
23:35:47FromDiscord<Elegantbeef> Did you antivirus prevent the installation?
23:35:52FromDiscord<Elegantbeef> your\
23:36:00FromDiscord<FractalCycle> In reply to @Elegantbeef "Did you antivirus prevent": no it said "failed - network error"
23:36:14FromDiscord<Elegantbeef> do you mean take two arrays and make it [(a1, a2), (b1, b2)]\`?
23:36:18FromDiscord<mratsim> In reply to @Mister_Magister "can i concat two": concat or zip?
23:36:30Mister_Magisterconnect together?
23:36:40Mister_Magistermarry them or smth
23:36:54FromDiscord<Elegantbeef> So `[a1, a2, b1, b2, b3]`
23:37:15Mister_Magisteras in connect array a and b into key and values
23:37:32Mister_Magistermap can do this i think?
23:37:34FromDiscord<mratsim> so zip
23:37:45FromDiscord<Elegantbeef> zip is what you want it sounds like
23:38:00FromDiscord<Elegantbeef> An input and output is easier than words
23:38:11FromDiscord<Elegantbeef> Give an example of input and expected output
23:38:22FromDiscord<Elegantbeef> Easierr than playing guess what i mean 😛
23:39:43*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:39:47FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/7uT
23:40:04FromDiscord<Elegantbeef> that should be `min(a.len, b.len)`
23:40:10FromDiscord<Isofruit> The more I code in nim the more I learn to appreciate the insane amounts of freedom
23:40:51FromDiscord<Elegantbeef> Just wait till i actually fix `type T[A; Y:static A]` 😀
23:40:59FromDiscord<Elegantbeef> Then we'll even be able to have modulo types
23:41:28FromDiscord<Isofruit> I mean, right now I'm in the beginner phase of all the meta programming stuff, I assume I'll look at my current code in disgust once I've developed a better feel for what leads to more readable code
23:41:41Mister_Magisteri think zip is the way to go
23:41:45FromDiscord<Isofruit> But dang
23:41:56Mister_Magistercan i iterate through zip result so that i have key and value variables?
23:42:14FromDiscord<Elegantbeef> for (x, y) in zip(a, b)\`
23:42:40FromDiscord<Elegantbeef> Worth noting that `zip` makes a new collection so you're allocating a collection `min(a.len, b.len)`
23:42:47Mister_Magisteri tried it but it gives me Error: identifier expected, but got '(' :/
23:42:52Mister_Magisteryou probably will want the code xd
23:43:02FromDiscord<Elegantbeef> Yea
23:43:13Mister_Magisterhttps://paste.opensuse.org/8c0225a5
23:43:50FromDiscord<Elegantbeef> What version of nim are you on?
23:44:01FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3M1M it runs fine
23:44:04Mister_Magister0.19.6
23:44:06Mister_Magistero
23:44:08Mister_Magisterooof
23:44:16FromDiscord<Elegantbeef> A bit fucking outdated arent you bud
23:44:27Mister_Magisteryeah… i forgot nobody updates it in opensuse repos
23:44:33Mister_Magisteri tried updating it but they rejected it eh
23:44:37Mister_Magisterchoosenim where are you
23:44:48FromDiscord<Elegantbeef> I think you've won oldest Nim version i've seen someone try to use
23:44:57Mister_Magisterxd
23:45:08Mister_Magisterwell i've been using nim for some time now
23:45:18FromDiscord<Isofruit> You can say that again
23:45:23FromDiscord<Elegantbeef> Hopefully not that version
23:45:29Mister_Magisternah nah
23:45:37Mister_Magisterlike im saying its just outdated in repos and i didn't notice
23:45:39Mister_Magisterchill
23:45:44FromDiscord<Elegantbeef> Bunch of cool features in the future dude, you're going to be excited for tuple for loop
23:45:47FromDiscord<Elegantbeef> I'm joking
23:45:59Mister_Magister:P
23:46:10Mister_MagisterF my vim freezed
23:46:17FromDiscord<Elegantbeef> I forget that not everyone is an active user here and knows my humour/jokes
23:47:24FromDiscord<Elegantbeef> @mratsim\: also if you have any examples of breaky when statements i'd be interested in seeing them
23:47:54FromDiscord<Elegantbeef> I'm only a pretend compiler dev, but it's fun to look at these issues nonetheless
23:48:00Mister_Magisteri'm now on 1.6.2
23:48:02Mister_Magisternow we talking
23:48:09Mister_Magisternewer than the one in topic
23:48:11FromDiscord<Elegantbeef> Welcome to 2022
23:49:58Mister_Magisterhow about doing `[a1, a2, b1, b2, b3]` ?
23:50:11FromDiscord<Elegantbeef> There is no array concatenation in the stdlib
23:50:17FromDiscord<Elegantbeef> But you can make it quickly
23:50:22FromDiscord<mratsim> In reply to @Elegantbeef "<@570268431522201601>\: also if you": mmmmh I think those in stint were all solved, took years but yeah.↵↵There there is "supportsCopyMem" in a when typesectionxnot sure if solved
23:50:25Mister_Magisterforget it
23:50:29Mister_Magisteri'll bypass it
23:50:40Mister_Magisteri mean, map would do it wouldn't it
23:50:44FromDiscord<mratsim> and then there is a veeeerrryyyy ugly issue that loat me a week and hair
23:50:45Mister_Magisterit totally would
23:53:00FromDiscord<mratsim> https://github.com/nim-lang/Nim/issues/13193↵↵@elegantbeef, but the issue is not when it seems
23:53:51Mister_Magisteryeah map did the job
23:54:23Mister_Magister@Elegantbeef https://paste.opensuse.org/2d0145e7
23:54:31Mister_Magisteryou proud of me papa
23:55:24FromDiscord<Elegantbeef> It's messy but here is how you'd do it https://play.nim-lang.org/#ix=3yC8
23:55:28FromDiscord<Elegantbeef> Had to hunt this down
23:55:55Mister_Magisterdid it cleaner
23:56:02Mister_Magisterfor my purpose
23:56:03FromDiscord<Elegantbeef> Not really that happy so many allocations!
23:56:12FromDiscord<mratsim> also https://github.com/status-im/nimbus-eth2/issues/2219 @ElegantBeef↵↵> Additional hacks to support when statement within an object declaration were needed or the serialization offsets were wrong
23:56:20*Mister_Magister angery screeching
23:56:35FromDiscord<mratsim> getTypeImpl is broken with when in types
23:57:10FromDiscord<mratsim> and when branches with fields of the same name
23:57:40FromDiscord<mratsim> and getImpl
23:57:49FromDiscord<mratsim> that was all uber ugly
23:57:55FromDiscord<Elegantbeef> Yea seems so
23:58:06FromDiscord<Elegantbeef> one of those shouldnt have `when` branches at all
23:58:27FromDiscord<Elegantbeef> Cant think of which at the moment
23:58:35FromDiscord<mratsim> https://github.com/nim-lang/Nim/issues/16639
23:59:10FromDiscord<Elegantbeef> `getImpl` shouldnt have the when trees in the ast
23:59:43FromDiscord<Elegantbeef> the implementation of `Attestation[Untrusted]` should be the transformed instantiated generic
23:59:49FromDiscord<mratsim> when + static enums cause visibility issues as well