<< 30-06-2023 >>

00:01:33FromDiscord<Chronos [She/Her]> Don't you have to do `cast[int]` to do pointer arithmetic?
00:01:59FromDiscord<Elegantbeef> That's what i said
00:02:23FromDiscord<Chronos [She/Her]> Not explicitly ,:P
00:18:18FromDiscord<teyako> Hi everyone! Just starting with Nim and I want to do some CRUD operations with a selfhosted mongoDB database. A quick google search directed me showed me https://github.com/SSPkrolik/nimongo (last updated 3y ago) and https://github.com/mashingan/anonimongo (updated last week). Anyone has any recommendation? Thanks!
00:18:40FromDiscord<teyako> (edit) removed "directed me"
00:29:36*derpydoo joined #nim
00:44:14FromDiscord<leetnewb> Nothing specific, but nimble.directory is a good place to search
01:20:56FromDiscord<teyako> True, should have checked the directory first. A quick search shows the anonimongo as the most promising I think. Thanks for pointing it out πŸ™‚
01:21:09*jmdaemon quit (Ping timeout: 250 seconds)
02:03:50*derpydoo quit (Ping timeout: 245 seconds)
02:47:23FromDiscord<ringabout> LOL, https://github.com/ziglang/zig/issues/16270 is trying to remove LLVM support and compiles to C. C IR does have merits.
02:52:23FromDiscord<huantian> it seems that they're trying to have multiple other targets as well?
02:54:56FromDiscord<Elegantbeef> It's not a small task, but it's a interesting one πŸ˜„
02:56:35FromDiscord<Elegantbeef> It also means that someone needs to replicate what zig presently does ontop of clang and make a new C compiler πŸ˜„
03:20:45FromDiscord<JJ> https://github.com/Vexu/arocc
03:21:14FromDiscord<JJ> zig --> c --> cc in zig --> binary? huh
03:38:57FromDiscord<Yardanico> In reply to @omentic "zig --> c -->": wat, no?
03:39:09FromDiscord<Yardanico> zig cc is not used for zig itself, it's specifically for C/C++ projects that want to potentially integrate Zig in the future
03:39:22FromDiscord<JJ> nono i mean arocc
03:39:24FromDiscord<Yardanico> zig itself has its own frontend and llvm for the main backend (it has others too)
03:39:32FromDiscord<Yardanico> In reply to @omentic "nono i mean arocc": yes, arocc is just a C compiler written in Zig
03:39:38FromDiscord<Yardanico> it doesn't use zig cc
03:40:01FromDiscord<JJ> yeah i didn't mean zig cc, i just meant a generic c compiler in zig
03:40:15FromDiscord<JJ> (is that where cc comes from? i don't actually know)
03:40:48FromDiscord<Yardanico> well i mean, it's not at all surprising, and doesn't really relate to Nim?
03:40:56FromDiscord<Yardanico> you can write a C compiler in Nim too, it's nothing unusual
03:41:04FromDiscord<Yardanico> you can write one in almost any language really
03:42:24FromDiscord<Elegantbeef> Technically JJ is zig -\> llvm -\> native if you import C code its C -\> Clang -\> llvm -\> native
03:43:00FromDiscord<Elegantbeef> `zigcc` is basically a frontend for clang with a few extra bells and whistles
03:45:34*flouer_ quit (Ping timeout: 260 seconds)
03:45:35FromDiscord<Yardanico> yeah, and arocc is just a normal standalone program written in zig
03:52:04FromDiscord<JJ> In reply to @Elegantbeef "`zigcc` is basically a": ah no see but they're considering dropping that
03:52:12FromDiscord<Elegantbeef> Right
03:52:30FromDiscord<Elegantbeef> It'd then be `Zig -> Zig IR -> Machine code`
03:52:34FromDiscord<Elegantbeef> And that's it
03:53:23FromDiscord<JJ> is there a zig ir?
03:53:38FromDiscord<Elegantbeef> Think the point is that they will be rewriting the entire backend
03:53:43FromDiscord<JJ> In reply to @Elegantbeef "Technically JJ is zig": what i find funny also is they're keeping the zig -> llvm step. just cutting out the llvm -> native step
03:57:14*ced1 joined #nim
04:00:09FromDiscord<Elegantbeef> Wait do they still plan on generating llvm?
04:00:58FromDiscord<ringabout> Yeah, just there is not first-class anymore.
04:01:05FromDiscord<ringabout> (edit) "not" => "no" | "nofirst-class ... anymore." added "support"
04:01:41FromDiscord<ringabout> > This will remove C++, Objective-C, and Objective-C++ compilation capabilities from Zig. ↡↡> Note that there would still be an LLVM backend for outputting .bc files (#13265), but the Zig compiler would lack the capability to compile .bc files into object files. LLVM or Clang would need to be installed and invoked separately for that use case.
04:08:18*azimut quit (*.net *.split)
04:09:22*azimut joined #nim
04:13:08FromDiscord<ringabout> Someone needs to turn `nkPtrLit` into a thing. Otherwise, it introduces a bunch of hacks in the VM.
04:57:56FromDiscord<uninnocent> sent a code paste, see https://play.nim-lang.org/#ix=4zqw
04:58:59FromDiscord<uninnocent> (edit) "https://play.nim-lang.org/#ix=4zqw" => "https://paste.rs/iXroA"
04:59:15FromDiscord<uninnocent> (edit) "https://play.nim-lang.org/#ix=4zqy" => "https://play.nim-lang.org/#ix=4zqx"
05:01:15FromDiscord<uninnocent> sent a code paste, see https://play.nim-lang.org/#ix=4zqA
05:10:16FromDiscord<graveflo> have you tried injecting a module?
05:11:31FromDiscord<uninnocent> Like a DLL?
05:12:29FromDiscord<graveflo> yea. I dont know too much about this stuff but I thought that windows PEs have their own bootstrapping process. idk if you can just inject a PE like that
05:12:31FromDiscord<uninnocent> I found some code online to make a dll in nimlang, but when I compile I get a huge error list
05:12:42FromDiscord<uninnocent> sent a code paste, see https://play.nim-lang.org/#ix=4zqC
05:12:57FromDiscord<uninnocent> sent a long message, see http://ix.io/4zqD
05:13:15FromDiscord<uninnocent> In reply to @graveflo "yea. I dont know": Probs not lol
05:13:23FromDiscord<uninnocent> worth a shot tho
05:14:43*derpydoo joined #nim
05:56:58*azimut quit (Ping timeout: 240 seconds)
06:09:29FromDiscord<gogolxdong666> Does httpclient follow redirection by default, and is there any way to make a disable option?
06:10:25FromDiscord<gogolxdong666> like `r = core.s.get(core.loginInfo['url'], headers=headers, allow_redirects=False)`
06:21:03FromDiscord<gogolxdong666> self.s = requests.Session()
06:33:08FromDiscord<Yardanico> In reply to @gogolxdong666 "Does httpclient follow redirection": https://nim-lang.org/docs/httpclient.html#redirects
06:36:04FromDiscord<gogolxdong666> ok, good to know, also fixed puppy by adding an option with default value
06:36:15FromDiscord<Yardanico> fwiw maxRedirects parameters is also available for all the client procs like get/post/etc
06:36:25FromDiscord<Yardanico> (edit) "parameters" => "parameter"
06:40:58FromDiscord<gogolxdong666> I'd like to use httpclient solution for convenience
06:45:00*PMunch joined #nim
07:04:15*ntat joined #nim
07:24:02*om3ga quit (Ping timeout: 252 seconds)
07:41:56FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4zqL
07:42:33FromDiscord<ambient3332> Current C API examples with c2nim conversions are fruitless
07:45:49PMunchHave you tried Futhark?
07:46:05FromDiscord<ambient3332> Yes, and I'm on Windows so I pretty much gave up after 5 minutes
07:46:08FromDiscord<Elegantbeef> Pmunch sounding like a drug dealer on the street corner
07:46:24PMunchHaha, I feel like that too
07:46:34PMunchDoesn't help that everyone who tries it gets kinda hooked
07:46:47PMunchambient3332, why would that make you give up?
07:47:00PMunchShould work just fine on Windows
07:47:04FromDiscord<ambient3332> I have enough just juggling gcc and vcc
07:47:50PMunchIf you're going to do any kind of C code wrapping I would highly recommend giving Futhark a serious go. I wrote it because I couldn't get c2nim to work for me
07:48:35FromDiscord<ambient3332> Yes, however my current problem is not understanding the C function pointers and Nim types well enough to do the conversation manually, which is why I asked
07:49:25PMunchManual conversion is the path to insanity
07:49:43FromDiscord<ambient3332> Only for large projects
07:50:05PMunchSure, you could get away with it for veeeery small stuff
07:50:20PMunchAnd yeah, it appears c2nim messed up that definition
07:50:25FromDiscord<ambient3332> And the function I'm talking about is the master key to Godot API basically
07:51:50PMunchDo you have a link to this API?
07:52:18FromDiscord<ambient3332> It's a dump from Godot 4 beta 1, you get the .h and .json, I run c2nim and did some manual fixes
07:52:48FromDiscord<ambient3332> https://github.com/gilzoide/hello-gdextension/blob/main/1.hello-c/README.md
07:53:02FromDiscord<Elegantbeef> https://github.com/chmod222/nimrodot
07:53:08FromDiscord<Elegantbeef> Someone already wrapped that code if you want a reference
07:53:56*om3ga joined #nim
07:56:45PMunchhttps://uploads.peterme.net/godot_futharked.nim
07:57:06PMunchThere's the output of running Futhark on the "gdnative_api_struct.gen.h" import
07:57:39FromDiscord<ambient3332> As I understand it, GDnative is the old, GDextension is the new (in Godot4)
07:58:58FromDiscord<ambient3332> Although if Futhark is so much better at C bindings, I might just run a VM for it
07:59:23FromDiscord<Elegantbeef> Wait pmunch did you add that feature to remove the numbers / when blocks?
07:59:27FromDiscord<Elegantbeef> I do not recall
07:59:37FromDiscord<Elegantbeef> I know it's the antithesis of the reason for futhark πŸ˜„
07:59:46FromDiscord<Elegantbeef> I think I ask you like every time we talk and forget
07:59:49PMunchElegantbeef, I did indeed
07:59:59PMunchnodeclguards
08:01:15PMunchhttps://uploads.peterme.net/godot_futharked_nodeclguards.nim
08:01:23PMunchThat's what it looks like with that option turned on
08:01:44PMunchambient3332, you shouldn't need a VM for it..
08:01:58FromDiscord<Elegantbeef> Much better
08:02:04PMunchMaybe I should look into creating statically linked pre-compiled versions of Opir I can ship with Futhark
08:02:12FromDiscord<ambient3332> yeah but I don't want to have another manual installation I have to worry about in Windows (LLVM)
08:02:21FromDiscord<Elegantbeef> That'd be smart
08:02:52PMunchOh would you look at that, Googled "libclang static link" and none other than deech have a repo for it :) https://github.com/deech/libclang-static-build
08:03:16FromDiscord<Elegantbeef> You lost me at "cmake"
08:03:36PMunchI mean you won't have to deal with this :P
08:03:50PMunchIf I can get a pipeline set up in GitHub actions or something that'd be sick
08:03:59FromDiscord<Elegantbeef> Yea
08:04:18FromDiscord<Elegantbeef> The only issue is still that they need a clang compiler on the target to properly use this
08:04:23FromDiscord<Elegantbeef> But atleast this reduces the libclang dep
08:04:51PMunchWait, they do?
08:05:06FromDiscord<Elegantbeef> Well you need to use a clang compiler to properly use futhark
08:05:12FromDiscord<Elegantbeef> properly is relative
08:05:15PMunchEh
08:05:28PMunchI always use GCC, works fine
08:05:42FromDiscord<Elegantbeef> One day... one day πŸ˜›
08:05:56PMunchI guess it technically isn't correct, but I'm not sure how many repos change their API definition based on which compiler you use :P
08:08:12PMunchambient3332, can't you get package managers for Windows these days?
08:08:24PMunchAlternatively save yourself the hassle and join the dark side :)
08:08:45FromDiscord<ambient3332> Windows is 90% of sales so it makes no sense to switch
08:09:09FromDiscord<ambient3332> 9% is MacOS
08:09:48PMunchWhy would that matter?
08:10:18FromDiscord<ambient3332> All use different systems for the entire software stack
08:10:25PMunchThe hassle of cross-compiling to Windows is well worth the loss of hassle of actually having to use Windows as your daily drivers..
08:10:46FromDiscord<ambient3332> Project often has 10x more moving parts than just a single binary
08:14:34PMunchAll the more reason to use a system which handles moving parts better than downloading random zip files and littering them across your disk :shrug:
08:15:23PMunchBut to each their own I guess, some people apparently like the thrill of pain and suffering, I'm not kind shaming
08:15:35FromDiscord<ambient3332> At some point I have to test the actual thing and the context switch is a huge hurdle between an OS
08:16:11PMunchThat's the sensible time to bring in a VM
08:17:11FromDiscord<ambient3332> Complexity doesn't scale linearily when you add another part, it scales exponentially
08:18:10PMunchExactly, that's why I like systems which can manage complexity for me
08:18:20FromDiscord<ambient3332> running Linux in VM is kinda pointless tho, outside very specific circumstances. You're either in one environment or the other
08:18:44PMunchAnd not have to run my dev tools in a VM because my OS doesn't have proper package management
08:19:11FromDiscord<ambient3332> Currently I have zero issues with my dev tools in Windows outside c2nim not giving me a running result
08:19:18PMunchBut yeah, statically linked Opir is now on my TODO :)
08:19:33PMunchso you have zero issues, except for some issues
08:20:01FromDiscord<ambient3332> Technically speaking, not some, one
08:46:16FromDiscord<gogolxdong666> sent a code paste, see https://play.nim-lang.org/#ix=4zqW
08:47:06FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4zqX
08:47:08FromDiscord<gogolxdong666> the first string is "wxuin=4080519942; Domain=wx.qq.com; Path=/; Expires=Fri, 30-Jun-2023 20:42:43 GMT; Secure"
08:47:11FromDiscord<Yardanico> oh, i see, multiple headers, it should work just fine
08:47:22FromDiscord<Yardanico> how are you doing the request?
08:47:48FromDiscord<gogolxdong666> var loginResponse = client.request(redirectUrl, headers= newHttpHeaders headers)
08:48:49FromDiscord<Yardanico> and how do you iterate over the response headers?
08:49:04FromDiscord<gogolxdong666> echo "loginBody:", loginBody, " ", loginResponse.headers
08:49:18FromDiscord<gogolxdong666> for k in loginResponse.headers["set-cookie"]:
08:50:59FromDiscord<gogolxdong666> any idea?
08:51:41FromDiscord<Yardanico> is it possible for you to give the url to me so I can do the request myself too?
08:51:53FromDiscord<Yardanico> or is it some authorized service?
08:53:42FromDiscord<gogolxdong666> It generates qrcode and scan via mobile phone to login
08:55:42FromDiscord<gogolxdong666> I can see header is there but cannot access the other strings except the first one.
08:56:25FromDiscord<Yardanico> can you try using https://nim-lang.org/docs/httpcore.html#pairs.i%2CHttpHeaders instead?
08:56:29FromDiscord<Yardanico> maybe that will work
08:56:39FromDiscord<Yardanico> (you don't have to import httpcore, it's exported by httpclient)
08:57:30FromDiscord<Yardanico> but really `for k in loginResponse.headers["set-cookie"]` should just work, I think in the past I didn't have any issues with headers that appear multiple times
08:59:06FromDiscord<gogolxdong666> (key: "wxuin=4080519942; Domain=wx.qq.com; Path=/; Expires=Fri, 30-Jun-2023 20", value: @["58:37 GMT; Secure"])
08:59:21FromDiscord<gogolxdong666> var setCookieHeader = parseHeader loginResponse.headers["set-cookie"]↡ echo setCookieHeader
08:59:51FromDiscord<Yardanico> no, i linked to the pairs iterator
08:59:52FromDiscord<Yardanico> not parseHeader
09:00:50FromDiscord<Yardanico> so you would do `for (key, value) in myresp.headers:`
09:03:59FromDiscord<Yardanico> yeah @gogolxdong666 weird issue, in the meanwhile you can just do this:
09:04:05FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4zr1
09:04:21FromDiscord<Yardanico> with .table you access the headers table directly, but really just resp.headers["set-cookie"] should give all 3 since it should be a seq
09:05:19FromDiscord<Yardanico> oh wait it's actually inteded i think, with `converter toString(values: HttpHeaderValues): string =`
09:05:46FromDiscord<Yardanico> yeah @gogolxdong666 it's intended I think, but poorly documented, you should either do with direct .table access or use the pairs iterator
09:07:01FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4zr5
09:07:08FromDiscord<Yardanico> of course you would then need to check that `key == "set-cookie"` yourself
09:07:39FromDiscord<Yardanico> oh right, another alternative is getOrDefault
09:08:04FromDiscord<Yardanico> same code as previous except without the loop we do `echo resp.headers.getOrDefault("set-cookie")`
09:08:15FromDiscord<Yardanico> ok nvm, that does not work again because of the converter
09:09:39FromDiscord<gogolxdong666> table works
09:09:47FromDiscord<Yardanico> you reminded me, I should see if I can test https://github.com/nim-lang/Nim/pull/19262 enough to maybe make it in time for 2.0
09:11:06FromDiscord<Yardanico> it's just that there's no one to review it regarding the changes for http stuff
09:19:11*PMunch_ joined #nim
09:21:59*PMunch quit (Ping timeout: 246 seconds)
09:32:10FromDiscord<spotlightkid> well, then write tests.
09:32:23*derpydoo quit (Ping timeout: 264 seconds)
10:53:48FromDiscord<d6b2445d> how do you compile exe with an icon?
10:57:31FromDiscord<Yardanico> In reply to @d6b2445d "how do you compile": you have to create it first externally, then link with a pragma
10:57:44FromDiscord<Yardanico> <https://github.com/nim-lang/Nim/blob/devel/compiler/nim.nim#L15>
10:57:54FromDiscord<d6b2445d> In reply to @yardanico "you have to create": okay
10:58:17FromDiscord<Yardanico> or you can just compile your program as normal, and then add an icon via an external tool
10:58:20FromDiscord<Yardanico> like resource hacker
10:58:27FromDiscord<d6b2445d> yeah that's what i was gonna do
10:59:12FromDiscord<d6b2445d> do i need to use resource hacker to make the file run with admin perms, or can i use some flag for that
11:02:57FromDiscord<Yardanico> In reply to @d6b2445d "do i need to": from some googling it seems like you either can compile and link with msvc (the linker has an option for that), or embed a manifest in your app
11:03:10FromDiscord<Yardanico> <https://stackoverflow.com/questions/33000158/embed-manifest-file-to-require-administrator-execution-level-with-mingw32> with resource hacker it seems
11:03:55FromDiscord<d6b2445d> okay thanks
11:20:25*PMunch_ is now known as PMunch
12:12:28*flouer_ joined #nim
12:42:34*PMunch quit (Quit: Leaving)
13:35:15*azimut joined #nim
14:15:12*flouer_ quit (Ping timeout: 258 seconds)
14:54:49*disso-peach quit (Quit: Leaving)
14:55:13FromDiscord<d6b2445d> it's been on this for ages, how do i know when it'll be finished https://media.discordapp.net/attachments/371759389889003532/1124352444202242078/image.png
14:57:06FromDiscord<spotlightkid> Sometimes GitHub is just acting up. Ctrl-C and try again.
15:00:12FromDiscord<d6b2445d> okay i manually installed it and it still gives me this: `Error: cannot open file: winim`
15:01:10FromDiscord<d6b2445d> sent a code paste, see https://paste.rs/Ubn4i
15:01:54FromDiscord<michaelb.eth> In reply to @d6b2445d "okay i manually installed": what version of Nim are you using?
15:02:05FromDiscord<d6b2445d> In reply to @michaelb.eth "what version of Nim": `Nim Compiler Version 1.6.14 [Windows: amd64]`
15:02:39FromDiscord<d6b2445d> do i need to upgrade?
15:02:46FromDiscord<jmgomez> Can you show the code, how are you using `winim`
15:03:44FromDiscord<d6b2445d> sent a code paste, see https://play.nim-lang.org/#ix=4zsa
15:04:27FromDiscord<jmgomez> In reply to @d6b2445d "okay i manually installed": what did you do to manually install it?
15:04:45FromDiscord<d6b2445d> sent a code paste, see https://play.nim-lang.org/#ix=4zsb
15:05:22FromDiscord<d6b2445d> sent a code paste, see https://play.nim-lang.org/#ix=4zsc
15:06:15FromDiscord<jmgomez> Im not that familiar with `nimble` as I dont tend to use it but it sounds to me like the issue may come from it not being in the nimble's path
15:06:53FromDiscord<jmgomez> You can add extra search paths to the compiler by using `-p` or `--path` https://nim-lang.org/docs/nimc.html
15:07:16FromDiscord<michaelb.eth> there's also `--nimblePath`
15:07:36FromDiscord<jmgomez> yeah, but that would likely mess the other pgks
15:08:15FromDiscord<jmgomez> well it says add a path, so maybe not
15:08:24FromDiscord<michaelb.eth> thankfully, it just adds a path that's searched
15:08:25FromDiscord<michaelb.eth> yeah
15:08:28FromDiscord<d6b2445d> In reply to @jmgomez "You can add extra": it worked thank you
15:08:39FromDiscord<michaelb.eth> what path did you add?
15:08:57FromDiscord<d6b2445d> the winim-master folder
15:09:06FromDiscord<michaelb.eth> that's what I thought, but was just curious
15:09:14FromDiscord<d6b2445d> yeah
15:09:38FromDiscord<michaelb.eth> seems like your Nim/nimble install isn't quite correct re: how your OS environment
15:09:52FromDiscord<michaelb.eth> are you running commands in `cmd.exe` or `PowerShell` or how exactly?
15:10:05FromDiscord<d6b2445d> cmd
15:10:11FromDiscord<michaelb.eth> (edit) "seems like your Nim/nimble install isn't quite correct re: how your OS environment ... " added "is setup"
15:10:23FromDiscord<d6b2445d> i dont really know what im doing, its my first day with nim
15:10:59FromDiscord<jmgomez> In reply to @ringabout "Someone needs to turn": that would allow for better casting too. But if you dont do it, not sure who else will πŸ˜›
15:23:08*flouer_ joined #nim
15:28:59FromDiscord<michaelb.eth> In reply to @d6b2445d "do i need to": no, that's the latest stable release, should be okay
15:29:31FromDiscord<Chronos [She/Her]> ElegentBeef any idea if it's possible to run WASM code, one instruction at a time with wasm3? :p
15:32:16FromDiscord<rainbowasteroids> nimlangserver or nimls
15:34:23FromDiscord<JJ> nimlangserver
15:47:22FromDiscord<heysokam> how would you make a `treeform/jsony` hook, such that:↡when it finds a key with a certain name, it returns the contents of that field as just a string?↡_(aka so that it can be later interpreted as another json after it has been loaded)_
15:47:40FromDiscord<heysokam> (edit) "`treeform/jsony`" => "`json`"
15:48:35FromDiscord<heysokam> (edit) "string?↡_(aka" => "string literally as it is in the json file?↡_(aka"
15:59:16FromDiscord<nervecenter> sent a code paste, see https://paste.rs/QU7Ap
15:59:52FromDiscord<nervecenter> (edit) "https://play.nim-lang.org/#ix=4zsr" => "https://paste.rs/lvSkW"
15:59:56FromDiscord<Yardanico> that won't make it output the value as it is in json
16:00:11FromDiscord<Yardanico> e.g. json escape sequences, etc, but you can just use the other json module proc for that
16:00:28FromDiscord<Yardanico> https://nim-lang.org/docs/json.html#escapeJson%2Cstring
16:04:52FromDiscord<heysokam> In reply to @nervecenter "Does it need to": yes, because it could fail to parse
16:04:58FromDiscord<heysokam> its arbitrary json, with unknown types
16:05:13FromDiscord<heysokam> it should be just stored as a string as it is, without any parsing
16:05:27FromDiscord<heysokam> (edit) "its arbitrary json, with unknown types ... " added "(or even broken json)"
16:06:00FromDiscord<Yardanico> In reply to @heysokam "it should be just": json.to allows you to keep parts of the json as JsonNode, but it won't work for broken json
16:06:11FromDiscord<Yardanico> you need to try jsony or something for broken json, but even then it might not work
16:06:27FromDiscord<heysokam> yeah thats why i was thinking of hooks
16:06:40FromDiscord<heysokam> i know it must be a parseHook from jsony, but i have no idea what to write in it
16:07:20FromDiscord<heysokam> all of the examples are encrypted with `i s dt v j` everywhere, so if you don't know what it does already its very much useless information
16:07:44FromDiscord<heysokam> i don't know if its parsing per-node, or what the values do and expect, etc
16:09:57*ormiret quit (Server closed connection)
16:10:15*ormiret joined #nim
16:14:33FromDiscord<heysokam> oh, seems like there is already functionality for it https://github.com/treeform/jsony#full-support-for-raw-json
17:18:57*flouer_ quit (Ping timeout: 245 seconds)
17:29:32*azimut quit (Remote host closed the connection)
17:29:53*azimut joined #nim
18:01:59*def- quit (Quit: -)
18:05:26*def- joined #nim
18:28:15FromDiscord<_alkamist_> sent a code paste, see https://play.nim-lang.org/#ix=4zsX
18:31:28*def- quit (Quit: -)
18:32:15FromDiscord<_alkamist_> Or maybe is there some way to make a list of arguments look like a type but not actually be a type?
18:32:41FromDiscord<heysokam> why not an object as argument?
18:32:49*def- joined #nim
18:32:50FromDiscord<heysokam> or even a tuple
18:32:51FromDiscord<_alkamist_> I want to be able to pass in var parameters
18:32:54FromDiscord<_alkamist_> and mutate them
18:33:10FromDiscord<heysokam> var object then?
18:33:19FromDiscord<_alkamist_> I want to mutate the original source
18:33:38FromDiscord<_alkamist_> So you can patch in args from different places
18:34:36FromDiscord<heysokam> if your args are ref, you could get away with the object
18:34:52FromDiscord<graveflo> what do you mean the original source? var args will mutate the object everywhere
18:35:44*def- quit (Client Quit)
18:36:03*def- joined #nim
18:36:13FromDiscord<_alkamist_> I'm chasing ideas I'm having about gui logic, and with something like Imgui, with a slider for instance, you pass in your own argument for the value of the slider, and the slider logic manipulates that value.
18:36:41FromDiscord<_alkamist_> I want to be able to have potentially long and cumbersome lists of arguments like that
18:36:54FromDiscord<_alkamist_> And I don't want to repeat them for every function that I write
18:37:26FromDiscord<_alkamist_> Essentially the user can provide the state
18:37:28FromDiscord<graveflo> it seems to me like you want an abstraction of objects then
18:37:43FromDiscord<Yardanico> In reply to @_alkamist_ "Is there something like": the closest to what you want if you want just the arguments is `using`
18:37:52FromDiscord<Yardanico> you still need to specify the arg name, but you won't have to repeat the type each time
18:38:04FromDiscord<_alkamist_> Yeah I'm thinking using might work potentially
18:38:08FromDiscord<Yardanico> otherwise create a pragma macro or something, or just use objects
18:38:23FromDiscord<_alkamist_> The problem with objects is that you have to copy the values
18:38:37FromDiscord<_alkamist_> Unless the object holds pointers, which seems weird
18:38:37FromDiscord<heysokam> objects can contain ref values
18:38:50FromDiscord<_alkamist_> I don't want to limit mutations to ref values
18:38:51FromDiscord<Yardanico> In reply to @_alkamist_ "The problem with objects": if you want to mutate, use `var x` or ref objects
18:38:57FromDiscord<Yardanico> `var T` works as well
18:39:32FromDiscord<_alkamist_> The user still has to create an object, it doesn't matter if the object is var, it won't mutate the original source of what was copied into the object
18:40:01FromDiscord<graveflo> whats the difference between passing args and creating an object. You can just make initializers if you want
18:40:17*flouer joined #nim
18:40:26FromDiscord<_alkamist_> Maybe I can try to make an example
18:42:43FromDiscord<rongcuid> I wonder. Is there an ETA for 2.0?
18:44:08FromDiscord<heysokam> In reply to @rongcuid "I wonder. Is there": when its done
18:44:16FromDiscord<_alkamist_> sent a code paste, see https://play.nim-lang.org/#ix=4zt0
18:45:14FromDiscord<Yardanico> the user should store those variables in the same object as well
18:45:22FromDiscord<Yardanico> you can expose the type for the user to use
18:45:36FromDiscord<graveflo> it's weird that you want the mutual state-fullness to not be encapsulated.
18:45:47FromDiscord<_alkamist_> Then the user is forced to collect the state in the same place, which isn't necessarily what I want for a dynamic gui experience.
18:46:20FromDiscord<_alkamist_> If they want to reuse state for multiple logic bits and patch it together, they have to make copies and keep them synced up just to pass in arguments
18:46:32FromDiscord<graveflo> why not have the user acquire the info they need from the ui elements instead of of juggling around loose variables?
18:47:21FromDiscord<_alkamist_> I've been toying around with a lot of ideas and that is one of them. But I'm chasing down an idea of having state being sort of loose in hash tables.
18:47:28FromDiscord<graveflo> it seems like you are trying to do something that is like having an "out" parameter in C?
18:47:34FromDiscord<_alkamist_> Yeah essentially
18:47:50FromDiscord<_alkamist_> But potentially everything in the logic could be an out parameter
18:48:04FromDiscord<_alkamist_> and patched in from various places, so you don't have to worry about copies and keeping things synced up
18:49:29FromDiscord<graveflo> interesting, but that is very odd. I think you will be fighting a lot to make that smooth. The behavior you are trying to model is done by encapsulating the data in objects. I'll think if I can have an idea that is in the vein that you are trying to do, but I believe that objects will work better for this
18:50:13FromDiscord<_alkamist_> It's not a super mature idea yet and I'm still figuring out if it's viable.
18:50:28FromDiscord<graveflo> basically if you want the user to not have to make a bunch of objects then have your code make them and then expose the objects to the user
18:51:36FromDiscord<graveflo> they shouldn't need to declare their own float, for example, if that data is managed by the UI element
18:52:29FromDiscord<_alkamist_> In reply to @graveflo "they shouldn't need to": The idea I had for that is by using default argument values, the user can choose which parts they want to patch in with mutable state via named arguments.
18:54:11FromDiscord<graveflo> so if the proc they are patching into has set parameters they might as well just patch the data into a managed objects behind the scenes. Without doing weird things with pointers that would be how its done I think
18:54:29FromDiscord<heysokam> ref objects sound a lot better from an api usability perspective, than this idea you mention
18:54:39FromDiscord<graveflo> you can generate spring-board procs that patch the values into the object I guess. idk
18:55:05FromDiscord<heysokam> (edit) "mention" => "mention↡at least from my superficial understanding of it, of course"
18:55:09FromDiscord<_alkamist_> I have made great progress using ref objects, it is definitely a good approach, I'm just exploring this idea.
18:55:24FromDiscord<heysokam> makes sense
18:56:05FromDiscord<_alkamist_> I'm almost trying to see if it's possible to encapsulate behavior completely in functions.
18:56:36FromDiscord<_alkamist_> Mutable state that the user is interested in can be passed in through arguments, and hidden state can be stored in hash tables on the fly.
18:56:53FromDiscord<_alkamist_> Also interesting state can be returned from functions.
18:59:23FromDiscord<graveflo> well you definitely can encapsulate behavior only in functions
19:00:05FromDiscord<graveflo> so whats the issue with just using `var` ? You don't want to have to dupe the signatures all over the place?
19:03:02FromDiscord<_alkamist_> Pretty much yeah, I don't want to dupe signatures for every function I make. It seems like the `using` statement might be a good way to deal with it, at the expense of still having to pass in all the args.
19:03:42FromDiscord<graveflo> also make note that the size of each of your stack frames is larger doing it this way then using an object
19:04:06FromDiscord<graveflo> I think the object might be slightly more efficient aswell as being an entity that is designed for this sort of thing
19:04:09FromDiscord<_alkamist_> I suppose that is a concern, I hadn't really thought about that much.
19:05:40FromDiscord<graveflo> besides that the only tool I can think of to eliminate the duplicated code would be meta-programming stuff. Ik you used the template initially but if that can't do it you might need a macro system to generate the signatures.
19:06:47FromDiscord<_alkamist_> Yeah the template I posted doesn't actually work, it was just to showcase the idea.
19:07:29FromDiscord<graveflo> you can generate signatures in a macro. I think the template might not be dynamic enough to do it
19:08:06FromDiscord<_alkamist_> Yeah macros would be a last resort for me because I struggle with them every time I try to write them.
19:53:20FromDiscord<Elegantbeef> @_alkamist_\: why not use a `ref float`?
19:53:24FromDiscord<Elegantbeef> Or `ptr float` if you want low level
19:55:08FromDiscord<_alkamist_> In reply to @Elegantbeef "<@277645179115143178>\: why not use": Like an object filled with ref arguments?
19:55:16FromDiscord<_alkamist_> (edit) "arguments?" => "fields?"
19:56:07FromDiscord<Elegantbeef> Of course
19:56:09FromDiscord<_alkamist_> And yeah pointers could be used but then the user is exposed to that.
19:56:22FromDiscord<Elegantbeef> Alternatively use generics + concepts
19:56:34FromDiscord<Elegantbeef> Consider looking at my gui 'framework'
19:56:46FromDiscord<Elegantbeef> https://github.com/beef331/gooey/
19:56:55FromDiscord<_alkamist_> I have looked at it, my IQ isn't high enough to understand.
19:57:17FromDiscord<Elegantbeef> I just use closure procedures
19:57:32FromDiscord<Elegantbeef> `onChange = proc(f: float32) = myFloat = f`
19:58:33FromDiscord<_alkamist_> I'm persuing a more immediate mode approach at the moment, not sure if I'll stick with it.
19:59:01FromDiscord<_alkamist_> (edit) "persuing" => "pursuing"
19:59:43FromDiscord<Elegantbeef> Well if you're doing immediate just do what dearimgui does and take in a `f: float32`
19:59:43FromDiscord<Elegantbeef> `f: var float32`
20:01:00FromDiscord<_alkamist_> Yeah that's what I am doing, but it led down this weird rabbit hole of wondering if all state could be represented in that way.
20:01:36FromDiscord<_alkamist_> And thinking of GUI elements as a collection of arguments to a function.
20:01:50FromDiscord<Elegantbeef> That doesnt sound immediate πŸ˜„
20:02:15FromDiscord<Elegantbeef> You could use the best generic data type the humble `tuple`
20:03:06FromDiscord<_alkamist_> So a tuple of ref fields? I'm not sure what that looks like on the user experience end, I haven't really used refs outside of a `ref object`
20:03:25FromDiscord<Elegantbeef> I mean `proc doThing(myGui: var tuple)`
20:04:14FromDiscord<_alkamist_> But that leads to the problem I was saying earlier that you have to make a tuple and copy the values in and then pass the tuple into the function, which mutates the values inside the tuple, not the orignal values.
20:04:55FromDiscord<Elegantbeef> Right but to mutate the stored object you do not want immediate
20:04:55FromDiscord<Elegantbeef> You're trying to get immediate gui without the immediacy
20:05:30FromDiscord<Elegantbeef> You either need to use `ptr T`, `ref T`, or closures
20:05:45FromDiscord<_alkamist_> I guess I don't know what the definition of immediate is then in this case.
20:06:32FromDiscord<_alkamist_> What I'm going for is the gui logic is controlled by control flow in a function repeated per frame, not callbacks.
20:06:46FromDiscord<Elegantbeef> Right so like dearimgui
20:06:58FromDiscord<_alkamist_> Yeah
20:07:07FromDiscord<Elegantbeef> Then you do what they do and use `var T`
20:07:17FromDiscord<Elegantbeef> You want flow control to be explicit so you make it explicit to use
20:07:46FromDiscord<Elegantbeef> You cannot make a tuple of UI elements cause UI elements are not really existential and are just procedures
20:08:40FromDiscord<_alkamist_> We may have just gone in a circle.
20:08:46FromDiscord<_alkamist_> In reply to @Elegantbeef "Then you do what": This is what I want
20:09:28FromDiscord<_alkamist_> But the problem is, then you can't conveniently pass arguments to a function if the list of arguments is long.
20:09:42FromDiscord<Elegantbeef> Right this is the down side of imgui πŸ˜„
20:09:43FromDiscord<_alkamist_> And you have to repeat argument signatures for all of the functions
20:10:02FromDiscord<_alkamist_> But I'm saying, it would be cool to be able to represent the idea of something as a collection of arguments
20:10:17FromDiscord<Elegantbeef> Imguis are extremely awkward to use, they're direct, but awkward
20:10:38FromDiscord<_alkamist_> Well what I am doing is exploring ways to try to make it less awkward.
20:11:04FromDiscord<_alkamist_> I have made some decent progress, with refs.
20:11:31FromDiscord<_alkamist_> I'm still experimenting though, and I'm thinking the var argument thing might be a dead end, not sure.
20:13:12FromDiscord<_alkamist_> Whenever I get into experimenting with gui logic I keep finding myself wanting to subvert the type system. No idea why.
20:14:00FromDiscord<Elegantbeef> No clue I really like the declarative style I have
20:14:06FromDiscord<Elegantbeef> So much nicer than dicking around with flow control
20:15:46FromDiscord<_alkamist_> I find the control flow based way to be very understandable if done right. An interesting thing is that you can lazily initialize GUI elements based on if they are reached in the code.
20:16:21FromDiscord<_alkamist_> The way I've been doing things currently, they come into being when they are reached.
20:17:27FromDiscord<Elegantbeef> I mean that's how imguis work
20:18:39FromDiscord<_alkamist_> Yeah, but I think the idea can be refined more.
20:19:46FromDiscord<_alkamist_> All of the imguis have some oddities that make them really clunky and hard to use when you want any custom behavior beyond what they give you.
20:19:56FromDiscord<_alkamist_> (edit) "All of the imguis ... have" added "I have seen"
20:26:06FromDiscord<Elegantbeef> See the issue to me is that you need to represent gui as complex flow control, it almost always just turns into nested flow control
20:26:23FromDiscord<Elegantbeef> As such it's just easier to represent it as a tree
20:27:16FromDiscord<_alkamist_> It doesn't have to be deeply nested, behavior can be broken out into functions. Also, I am experimenting with doing a tree based immediate mode gui approach.
20:27:51FromDiscord<Elegantbeef> Sure you can use functions, but to me it always just feels like hiding flow control of the gui πŸ˜„
20:28:04*ced1 is now known as cedb
20:28:43FromDiscord<_alkamist_> I think that's where most immediate mode guis get it wrong, they don't allow access to a lot of state.
20:29:32FromDiscord<Elegantbeef> Well I have no issue contributing ideas to another gui framework πŸ˜„
20:29:56FromDiscord<Elegantbeef> To be fair My solution isnt ideal either, given I use `include` now to reduce the amount of mess inside my files https://github.com/beef331/mindthegap3D/blob/master/src/core/worldui.nim
20:30:03FromDiscord<Elegantbeef> My gui is quite large πŸ˜„
20:34:25FromDiscord<_alkamist_> In reply to @Elegantbeef "Well I have no": If you want to see what I have been working on, it's here https://github.com/Alkamist/nimgui/tree/3341ee4ea717694f5bc62659194a4fd81cc6c84c
20:35:31FromDiscord<_alkamist_> It works on windows and webassembly but you would need to get my oswindow library too.
20:35:47FromDiscord<Elegantbeef> Well then it doesnt work
20:36:48FromDiscord<_alkamist_> Well I mean the only reason it doesn't work on other platforms is I haven't written it into my windowing library yet because I don't have a linux system to test on.
20:37:19FromDiscord<Elegantbeef> Right sounds like you should've just used sdl2 or gflw or windy πŸ˜›
20:38:00FromDiscord<_alkamist_> I have weird constraints that those libraries don't take into account.
20:38:30FromDiscord<Elegantbeef> I mean your GUI shouldnt rely on a backend
20:39:01FromDiscord<_alkamist_> The GUI logic itself doesn't rely on the backend
20:39:07FromDiscord<_alkamist_> You could bind it to another one.
20:39:23FromDiscord<Elegantbeef> In user code or by forking?
20:39:28FromDiscord<_alkamist_> user code.
20:40:43FromDiscord<Elegantbeef> What are the weird constraints anyway?
20:41:46FromDiscord<_alkamist_> I am interested in writing plugins for digital audio workstations, and they require creating multiple windows hosted and embedded inside a parent window.
20:42:15FromDiscord<_alkamist_> It's probably possible to adapt those libraries to do that but I just ended up writing it myself to get the behavior how I want it.
20:43:27FromDiscord<Zoom> @_alkamist_\: thanks for your Reaper SDK bindings, btw. Do you plan to maintain them?
20:43:38*junaid_ joined #nim
20:44:51FromDiscord<Elegantbeef> Arent you just describing faux windows, or does it create multiple real windows?
20:46:28FromDiscord<_alkamist_> In reply to @Zoom "<@277645179115143178>\: thanks for your": Hi! You're welcome, I'm surprised someone uses them. I made them for personal use and I just usually have my github repos public. I'll probably just update them as I use them.
20:46:54FromDiscord<_alkamist_> In reply to @Elegantbeef "Arent you just describing": Real windows that get embedded.
20:47:09FromDiscord<_alkamist_> Like real operating system windows.
20:48:39FromDiscord<Elegantbeef> Right so just create windows a few times then when you drag a window ontop of another you close that one but keep it's context alive or whatever
20:51:25FromDiscord<_alkamist_> I just found it easier to do it myself, most windowing libraries have random behavior I find annoying.
20:52:26FromDiscord<_alkamist_> There's this dumb issue on windows where if you grab or resize a window it freezes the processing.
20:53:06FromDiscord<_alkamist_> And in glfw for emscripten, the mouse doesn't get captured when it leaves the window leading to annoying behavior.
20:53:37*junaid_ quit (Remote host closed the connection)
20:58:49*ntat quit (Quit: Leaving)
21:12:24FromDiscord<Zoom> Since the repo was undocumented and there was some duplication between two repositories, I was surprised when it all compiled and worked \:P↡(@_alkamist_)
21:15:30FromDiscord<_alkamist_> In reply to @Zoom "Since the repo was": Yeah unfortunately my coding practices are very sporadic and unorganized. I am a hobbyist programmer and I usually only program for myself. I'm glad you are finding it useful though!
21:27:32*flouer quit (Ping timeout: 240 seconds)
21:38:27FromDiscord<Zoom> I'm interested in the field (though, not doing anything at the moment), pm if you feel the need to vent your ideas to someone or want someone else's eyes to go over your code.↡(@_alkamist_)
21:42:08FromDiscord<_alkamist_> In reply to @Zoom "I'm interested in the": I appreciate it!
22:10:06NimEventerNew thread by PMunch: RIP Nitter, see https://forum.nim-lang.org/t/10313
22:29:42FromDiscord<simonkrauter> Anyone here using 2.0 RC2 under linux, who can try to reproduce my ORC issue https://github.com/nim-lang/Nim/issues/22200 ?
22:32:31FromDiscord<Elegantbeef> I think I can reproduce an issue, get a binary string for `oldJson`
22:33:18FromDiscord<simonkrauter> ok, yes, sometimes it contains non-printable characters. thanks.
22:33:40*flouer joined #nim
22:36:04FromDiscord<Elegantbeef> I'd suggest to use `std/json` over `std/marshal`
22:36:27FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/qVjlo
22:36:28FromDiscord<Elegantbeef> Or atleast I think πŸ˜„
22:37:10FromDiscord<Elegantbeef> This does seem to be a `std/marshal` bug, I still am lost why that module exists
22:38:50FromDiscord<simonkrauter> Ok, this is useful information, can you add it as comment to the github issue?
22:42:25FromDiscord<simonkrauter> I have added the information, that it's related to std/marshal.
22:42:43FromDiscord<Elegantbeef> Hey i was going to but I went back to programming πŸ˜„
23:00:02*marcus quit (Remote host closed the connection)
23:00:45*marcus joined #nim
23:58:11*derpydoo joined #nim
23:59:17*lucasta joined #nim