00:01:33 | FromDiscord | <Chronos [She/Her]> Don't you have to do `cast[int]` to do pointer arithmetic? |
00:01:59 | FromDiscord | <Elegantbeef> That's what i said |
00:02:23 | FromDiscord | <Chronos [She/Her]> Not explicitly ,:P |
00:18:18 | FromDiscord | <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:40 | FromDiscord | <teyako> (edit) removed "directed me" |
00:29:36 | * | derpydoo joined #nim |
00:44:14 | FromDiscord | <leetnewb> Nothing specific, but nimble.directory is a good place to search |
01:20:56 | FromDiscord | <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:23 | FromDiscord | <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:23 | FromDiscord | <huantian> it seems that they're trying to have multiple other targets as well? |
02:54:56 | FromDiscord | <Elegantbeef> It's not a small task, but it's a interesting one π |
02:56:35 | FromDiscord | <Elegantbeef> It also means that someone needs to replicate what zig presently does ontop of clang and make a new C compiler π |
03:20:45 | FromDiscord | <JJ> https://github.com/Vexu/arocc |
03:21:14 | FromDiscord | <JJ> zig --> c --> cc in zig --> binary? huh |
03:38:57 | FromDiscord | <Yardanico> In reply to @omentic "zig --> c -->": wat, no? |
03:39:09 | FromDiscord | <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:22 | FromDiscord | <JJ> nono i mean arocc |
03:39:24 | FromDiscord | <Yardanico> zig itself has its own frontend and llvm for the main backend (it has others too) |
03:39:32 | FromDiscord | <Yardanico> In reply to @omentic "nono i mean arocc": yes, arocc is just a C compiler written in Zig |
03:39:38 | FromDiscord | <Yardanico> it doesn't use zig cc |
03:40:01 | FromDiscord | <JJ> yeah i didn't mean zig cc, i just meant a generic c compiler in zig |
03:40:15 | FromDiscord | <JJ> (is that where cc comes from? i don't actually know) |
03:40:48 | FromDiscord | <Yardanico> well i mean, it's not at all surprising, and doesn't really relate to Nim? |
03:40:56 | FromDiscord | <Yardanico> you can write a C compiler in Nim too, it's nothing unusual |
03:41:04 | FromDiscord | <Yardanico> you can write one in almost any language really |
03:42:24 | FromDiscord | <Elegantbeef> Technically JJ is zig -\> llvm -\> native if you import C code its C -\> Clang -\> llvm -\> native |
03:43:00 | FromDiscord | <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:35 | FromDiscord | <Yardanico> yeah, and arocc is just a normal standalone program written in zig |
03:52:04 | FromDiscord | <JJ> In reply to @Elegantbeef "`zigcc` is basically a": ah no see but they're considering dropping that |
03:52:12 | FromDiscord | <Elegantbeef> Right |
03:52:30 | FromDiscord | <Elegantbeef> It'd then be `Zig -> Zig IR -> Machine code` |
03:52:34 | FromDiscord | <Elegantbeef> And that's it |
03:53:23 | FromDiscord | <JJ> is there a zig ir? |
03:53:38 | FromDiscord | <Elegantbeef> Think the point is that they will be rewriting the entire backend |
03:53:43 | FromDiscord | <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:09 | FromDiscord | <Elegantbeef> Wait do they still plan on generating llvm? |
04:00:58 | FromDiscord | <ringabout> Yeah, just there is not first-class anymore. |
04:01:05 | FromDiscord | <ringabout> (edit) "not" => "no" | "nofirst-class ... anymore." added "support" |
04:01:41 | FromDiscord | <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:08 | FromDiscord | <ringabout> Someone needs to turn `nkPtrLit` into a thing. Otherwise, it introduces a bunch of hacks in the VM. |
04:57:56 | FromDiscord | <uninnocent> sent a code paste, see https://play.nim-lang.org/#ix=4zqw |
04:58:59 | FromDiscord | <uninnocent> (edit) "https://play.nim-lang.org/#ix=4zqw" => "https://paste.rs/iXroA" |
04:59:15 | FromDiscord | <uninnocent> (edit) "https://play.nim-lang.org/#ix=4zqy" => "https://play.nim-lang.org/#ix=4zqx" |
05:01:15 | FromDiscord | <uninnocent> sent a code paste, see https://play.nim-lang.org/#ix=4zqA |
05:10:16 | FromDiscord | <graveflo> have you tried injecting a module? |
05:11:31 | FromDiscord | <uninnocent> Like a DLL? |
05:12:29 | FromDiscord | <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:31 | FromDiscord | <uninnocent> I found some code online to make a dll in nimlang, but when I compile I get a huge error list |
05:12:42 | FromDiscord | <uninnocent> sent a code paste, see https://play.nim-lang.org/#ix=4zqC |
05:12:57 | FromDiscord | <uninnocent> sent a long message, see http://ix.io/4zqD |
05:13:15 | FromDiscord | <uninnocent> In reply to @graveflo "yea. I dont know": Probs not lol |
05:13:23 | FromDiscord | <uninnocent> worth a shot tho |
05:14:43 | * | derpydoo joined #nim |
05:56:58 | * | azimut quit (Ping timeout: 240 seconds) |
06:09:29 | FromDiscord | <gogolxdong666> Does httpclient follow redirection by default, and is there any way to make a disable option? |
06:10:25 | FromDiscord | <gogolxdong666> like `r = core.s.get(core.loginInfo['url'], headers=headers, allow_redirects=False)` |
06:21:03 | FromDiscord | <gogolxdong666> self.s = requests.Session() |
06:33:08 | FromDiscord | <Yardanico> In reply to @gogolxdong666 "Does httpclient follow redirection": https://nim-lang.org/docs/httpclient.html#redirects |
06:36:04 | FromDiscord | <gogolxdong666> ok, good to know, also fixed puppy by adding an option with default value |
06:36:15 | FromDiscord | <Yardanico> fwiw maxRedirects parameters is also available for all the client procs like get/post/etc |
06:36:25 | FromDiscord | <Yardanico> (edit) "parameters" => "parameter" |
06:40:58 | FromDiscord | <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:56 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4zqL |
07:42:33 | FromDiscord | <ambient3332> Current C API examples with c2nim conversions are fruitless |
07:45:49 | PMunch | Have you tried Futhark? |
07:46:05 | FromDiscord | <ambient3332> Yes, and I'm on Windows so I pretty much gave up after 5 minutes |
07:46:08 | FromDiscord | <Elegantbeef> Pmunch sounding like a drug dealer on the street corner |
07:46:24 | PMunch | Haha, I feel like that too |
07:46:34 | PMunch | Doesn't help that everyone who tries it gets kinda hooked |
07:46:47 | PMunch | ambient3332, why would that make you give up? |
07:47:00 | PMunch | Should work just fine on Windows |
07:47:04 | FromDiscord | <ambient3332> I have enough just juggling gcc and vcc |
07:47:50 | PMunch | If 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:35 | FromDiscord | <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:25 | PMunch | Manual conversion is the path to insanity |
07:49:43 | FromDiscord | <ambient3332> Only for large projects |
07:50:05 | PMunch | Sure, you could get away with it for veeeery small stuff |
07:50:20 | PMunch | And yeah, it appears c2nim messed up that definition |
07:50:25 | FromDiscord | <ambient3332> And the function I'm talking about is the master key to Godot API basically |
07:51:50 | PMunch | Do you have a link to this API? |
07:52:18 | FromDiscord | <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:48 | FromDiscord | <ambient3332> https://github.com/gilzoide/hello-gdextension/blob/main/1.hello-c/README.md |
07:53:02 | FromDiscord | <Elegantbeef> https://github.com/chmod222/nimrodot |
07:53:08 | FromDiscord | <Elegantbeef> Someone already wrapped that code if you want a reference |
07:53:56 | * | om3ga joined #nim |
07:56:45 | PMunch | https://uploads.peterme.net/godot_futharked.nim |
07:57:06 | PMunch | There's the output of running Futhark on the "gdnative_api_struct.gen.h" import |
07:57:39 | FromDiscord | <ambient3332> As I understand it, GDnative is the old, GDextension is the new (in Godot4) |
07:58:58 | FromDiscord | <ambient3332> Although if Futhark is so much better at C bindings, I might just run a VM for it |
07:59:23 | FromDiscord | <Elegantbeef> Wait pmunch did you add that feature to remove the numbers / when blocks? |
07:59:27 | FromDiscord | <Elegantbeef> I do not recall |
07:59:37 | FromDiscord | <Elegantbeef> I know it's the antithesis of the reason for futhark π |
07:59:46 | FromDiscord | <Elegantbeef> I think I ask you like every time we talk and forget |
07:59:49 | PMunch | Elegantbeef, I did indeed |
07:59:59 | PMunch | nodeclguards |
08:01:15 | PMunch | https://uploads.peterme.net/godot_futharked_nodeclguards.nim |
08:01:23 | PMunch | That's what it looks like with that option turned on |
08:01:44 | PMunch | ambient3332, you shouldn't need a VM for it.. |
08:01:58 | FromDiscord | <Elegantbeef> Much better |
08:02:04 | PMunch | Maybe I should look into creating statically linked pre-compiled versions of Opir I can ship with Futhark |
08:02:12 | FromDiscord | <ambient3332> yeah but I don't want to have another manual installation I have to worry about in Windows (LLVM) |
08:02:21 | FromDiscord | <Elegantbeef> That'd be smart |
08:02:52 | PMunch | Oh 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:16 | FromDiscord | <Elegantbeef> You lost me at "cmake" |
08:03:36 | PMunch | I mean you won't have to deal with this :P |
08:03:50 | PMunch | If I can get a pipeline set up in GitHub actions or something that'd be sick |
08:03:59 | FromDiscord | <Elegantbeef> Yea |
08:04:18 | FromDiscord | <Elegantbeef> The only issue is still that they need a clang compiler on the target to properly use this |
08:04:23 | FromDiscord | <Elegantbeef> But atleast this reduces the libclang dep |
08:04:51 | PMunch | Wait, they do? |
08:05:06 | FromDiscord | <Elegantbeef> Well you need to use a clang compiler to properly use futhark |
08:05:12 | FromDiscord | <Elegantbeef> properly is relative |
08:05:15 | PMunch | Eh |
08:05:28 | PMunch | I always use GCC, works fine |
08:05:42 | FromDiscord | <Elegantbeef> One day... one day π |
08:05:56 | PMunch | I 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:12 | PMunch | ambient3332, can't you get package managers for Windows these days? |
08:08:24 | PMunch | Alternatively save yourself the hassle and join the dark side :) |
08:08:45 | FromDiscord | <ambient3332> Windows is 90% of sales so it makes no sense to switch |
08:09:09 | FromDiscord | <ambient3332> 9% is MacOS |
08:09:48 | PMunch | Why would that matter? |
08:10:18 | FromDiscord | <ambient3332> All use different systems for the entire software stack |
08:10:25 | PMunch | The 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:46 | FromDiscord | <ambient3332> Project often has 10x more moving parts than just a single binary |
08:14:34 | PMunch | All 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:23 | PMunch | But to each their own I guess, some people apparently like the thrill of pain and suffering, I'm not kind shaming |
08:15:35 | FromDiscord | <ambient3332> At some point I have to test the actual thing and the context switch is a huge hurdle between an OS |
08:16:11 | PMunch | That's the sensible time to bring in a VM |
08:17:11 | FromDiscord | <ambient3332> Complexity doesn't scale linearily when you add another part, it scales exponentially |
08:18:10 | PMunch | Exactly, that's why I like systems which can manage complexity for me |
08:18:20 | FromDiscord | <ambient3332> running Linux in VM is kinda pointless tho, outside very specific circumstances. You're either in one environment or the other |
08:18:44 | PMunch | And not have to run my dev tools in a VM because my OS doesn't have proper package management |
08:19:11 | FromDiscord | <ambient3332> Currently I have zero issues with my dev tools in Windows outside c2nim not giving me a running result |
08:19:18 | PMunch | But yeah, statically linked Opir is now on my TODO :) |
08:19:33 | PMunch | so you have zero issues, except for some issues |
08:20:01 | FromDiscord | <ambient3332> Technically speaking, not some, one |
08:46:16 | FromDiscord | <gogolxdong666> sent a code paste, see https://play.nim-lang.org/#ix=4zqW |
08:47:06 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4zqX |
08:47:08 | FromDiscord | <gogolxdong666> the first string is "wxuin=4080519942; Domain=wx.qq.com; Path=/; Expires=Fri, 30-Jun-2023 20:42:43 GMT; Secure" |
08:47:11 | FromDiscord | <Yardanico> oh, i see, multiple headers, it should work just fine |
08:47:22 | FromDiscord | <Yardanico> how are you doing the request? |
08:47:48 | FromDiscord | <gogolxdong666> var loginResponse = client.request(redirectUrl, headers= newHttpHeaders headers) |
08:48:49 | FromDiscord | <Yardanico> and how do you iterate over the response headers? |
08:49:04 | FromDiscord | <gogolxdong666> echo "loginBody:", loginBody, " ", loginResponse.headers |
08:49:18 | FromDiscord | <gogolxdong666> for k in loginResponse.headers["set-cookie"]: |
08:50:59 | FromDiscord | <gogolxdong666> any idea? |
08:51:41 | FromDiscord | <Yardanico> is it possible for you to give the url to me so I can do the request myself too? |
08:51:53 | FromDiscord | <Yardanico> or is it some authorized service? |
08:53:42 | FromDiscord | <gogolxdong666> It generates qrcode and scan via mobile phone to login |
08:55:42 | FromDiscord | <gogolxdong666> I can see header is there but cannot access the other strings except the first one. |
08:56:25 | FromDiscord | <Yardanico> can you try using https://nim-lang.org/docs/httpcore.html#pairs.i%2CHttpHeaders instead? |
08:56:29 | FromDiscord | <Yardanico> maybe that will work |
08:56:39 | FromDiscord | <Yardanico> (you don't have to import httpcore, it's exported by httpclient) |
08:57:30 | FromDiscord | <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:06 | FromDiscord | <gogolxdong666> (key: "wxuin=4080519942; Domain=wx.qq.com; Path=/; Expires=Fri, 30-Jun-2023 20", value: @["58:37 GMT; Secure"]) |
08:59:21 | FromDiscord | <gogolxdong666> var setCookieHeader = parseHeader loginResponse.headers["set-cookie"]β΅ echo setCookieHeader |
08:59:51 | FromDiscord | <Yardanico> no, i linked to the pairs iterator |
08:59:52 | FromDiscord | <Yardanico> not parseHeader |
09:00:50 | FromDiscord | <Yardanico> so you would do `for (key, value) in myresp.headers:` |
09:03:59 | FromDiscord | <Yardanico> yeah @gogolxdong666 weird issue, in the meanwhile you can just do this: |
09:04:05 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4zr1 |
09:04:21 | FromDiscord | <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:19 | FromDiscord | <Yardanico> oh wait it's actually inteded i think, with `converter toString(values: HttpHeaderValues): string =` |
09:05:46 | FromDiscord | <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:01 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4zr5 |
09:07:08 | FromDiscord | <Yardanico> of course you would then need to check that `key == "set-cookie"` yourself |
09:07:39 | FromDiscord | <Yardanico> oh right, another alternative is getOrDefault |
09:08:04 | FromDiscord | <Yardanico> same code as previous except without the loop we do `echo resp.headers.getOrDefault("set-cookie")` |
09:08:15 | FromDiscord | <Yardanico> ok nvm, that does not work again because of the converter |
09:09:39 | FromDiscord | <gogolxdong666> table works |
09:09:47 | FromDiscord | <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:06 | FromDiscord | <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:10 | FromDiscord | <spotlightkid> well, then write tests. |
09:32:23 | * | derpydoo quit (Ping timeout: 264 seconds) |
10:53:48 | FromDiscord | <d6b2445d> how do you compile exe with an icon? |
10:57:31 | FromDiscord | <Yardanico> In reply to @d6b2445d "how do you compile": you have to create it first externally, then link with a pragma |
10:57:44 | FromDiscord | <Yardanico> <https://github.com/nim-lang/Nim/blob/devel/compiler/nim.nim#L15> |
10:57:54 | FromDiscord | <d6b2445d> In reply to @yardanico "you have to create": okay |
10:58:17 | FromDiscord | <Yardanico> or you can just compile your program as normal, and then add an icon via an external tool |
10:58:20 | FromDiscord | <Yardanico> like resource hacker |
10:58:27 | FromDiscord | <d6b2445d> yeah that's what i was gonna do |
10:59:12 | FromDiscord | <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:57 | FromDiscord | <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:10 | FromDiscord | <Yardanico> <https://stackoverflow.com/questions/33000158/embed-manifest-file-to-require-administrator-execution-level-with-mingw32> with resource hacker it seems |
11:03:55 | FromDiscord | <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:13 | FromDiscord | <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:06 | FromDiscord | <spotlightkid> Sometimes GitHub is just acting up. Ctrl-C and try again. |
15:00:12 | FromDiscord | <d6b2445d> okay i manually installed it and it still gives me this: `Error: cannot open file: winim` |
15:01:10 | FromDiscord | <d6b2445d> sent a code paste, see https://paste.rs/Ubn4i |
15:01:54 | FromDiscord | <michaelb.eth> In reply to @d6b2445d "okay i manually installed": what version of Nim are you using? |
15:02:05 | FromDiscord | <d6b2445d> In reply to @michaelb.eth "what version of Nim": `Nim Compiler Version 1.6.14 [Windows: amd64]` |
15:02:39 | FromDiscord | <d6b2445d> do i need to upgrade? |
15:02:46 | FromDiscord | <jmgomez> Can you show the code, how are you using `winim` |
15:03:44 | FromDiscord | <d6b2445d> sent a code paste, see https://play.nim-lang.org/#ix=4zsa |
15:04:27 | FromDiscord | <jmgomez> In reply to @d6b2445d "okay i manually installed": what did you do to manually install it? |
15:04:45 | FromDiscord | <d6b2445d> sent a code paste, see https://play.nim-lang.org/#ix=4zsb |
15:05:22 | FromDiscord | <d6b2445d> sent a code paste, see https://play.nim-lang.org/#ix=4zsc |
15:06:15 | FromDiscord | <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:53 | FromDiscord | <jmgomez> You can add extra search paths to the compiler by using `-p` or `--path` https://nim-lang.org/docs/nimc.html |
15:07:16 | FromDiscord | <michaelb.eth> there's also `--nimblePath` |
15:07:36 | FromDiscord | <jmgomez> yeah, but that would likely mess the other pgks |
15:08:15 | FromDiscord | <jmgomez> well it says add a path, so maybe not |
15:08:24 | FromDiscord | <michaelb.eth> thankfully, it just adds a path that's searched |
15:08:25 | FromDiscord | <michaelb.eth> yeah |
15:08:28 | FromDiscord | <d6b2445d> In reply to @jmgomez "You can add extra": it worked thank you |
15:08:39 | FromDiscord | <michaelb.eth> what path did you add? |
15:08:57 | FromDiscord | <d6b2445d> the winim-master folder |
15:09:06 | FromDiscord | <michaelb.eth> that's what I thought, but was just curious |
15:09:14 | FromDiscord | <d6b2445d> yeah |
15:09:38 | FromDiscord | <michaelb.eth> seems like your Nim/nimble install isn't quite correct re: how your OS environment |
15:09:52 | FromDiscord | <michaelb.eth> are you running commands in `cmd.exe` or `PowerShell` or how exactly? |
15:10:05 | FromDiscord | <d6b2445d> cmd |
15:10:11 | FromDiscord | <michaelb.eth> (edit) "seems like your Nim/nimble install isn't quite correct re: how your OS environment ... " added "is setup" |
15:10:23 | FromDiscord | <d6b2445d> i dont really know what im doing, its my first day with nim |
15:10:59 | FromDiscord | <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:59 | FromDiscord | <michaelb.eth> In reply to @d6b2445d "do i need to": no, that's the latest stable release, should be okay |
15:29:31 | FromDiscord | <Chronos [She/Her]> ElegentBeef any idea if it's possible to run WASM code, one instruction at a time with wasm3? :p |
15:32:16 | FromDiscord | <rainbowasteroids> nimlangserver or nimls |
15:34:23 | FromDiscord | <JJ> nimlangserver |
15:47:22 | FromDiscord | <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:40 | FromDiscord | <heysokam> (edit) "`treeform/jsony`" => "`json`" |
15:48:35 | FromDiscord | <heysokam> (edit) "string?β΅_(aka" => "string literally as it is in the json file?β΅_(aka" |
15:59:16 | FromDiscord | <nervecenter> sent a code paste, see https://paste.rs/QU7Ap |
15:59:52 | FromDiscord | <nervecenter> (edit) "https://play.nim-lang.org/#ix=4zsr" => "https://paste.rs/lvSkW" |
15:59:56 | FromDiscord | <Yardanico> that won't make it output the value as it is in json |
16:00:11 | FromDiscord | <Yardanico> e.g. json escape sequences, etc, but you can just use the other json module proc for that |
16:00:28 | FromDiscord | <Yardanico> https://nim-lang.org/docs/json.html#escapeJson%2Cstring |
16:04:52 | FromDiscord | <heysokam> In reply to @nervecenter "Does it need to": yes, because it could fail to parse |
16:04:58 | FromDiscord | <heysokam> its arbitrary json, with unknown types |
16:05:13 | FromDiscord | <heysokam> it should be just stored as a string as it is, without any parsing |
16:05:27 | FromDiscord | <heysokam> (edit) "its arbitrary json, with unknown types ... " added "(or even broken json)" |
16:06:00 | FromDiscord | <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:11 | FromDiscord | <Yardanico> you need to try jsony or something for broken json, but even then it might not work |
16:06:27 | FromDiscord | <heysokam> yeah thats why i was thinking of hooks |
16:06:40 | FromDiscord | <heysokam> i know it must be a parseHook from jsony, but i have no idea what to write in it |
16:07:20 | FromDiscord | <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:44 | FromDiscord | <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:33 | FromDiscord | <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:15 | FromDiscord | <_alkamist_> sent a code paste, see https://play.nim-lang.org/#ix=4zsX |
18:31:28 | * | def- quit (Quit: -) |
18:32:15 | FromDiscord | <_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:41 | FromDiscord | <heysokam> why not an object as argument? |
18:32:49 | * | def- joined #nim |
18:32:50 | FromDiscord | <heysokam> or even a tuple |
18:32:51 | FromDiscord | <_alkamist_> I want to be able to pass in var parameters |
18:32:54 | FromDiscord | <_alkamist_> and mutate them |
18:33:10 | FromDiscord | <heysokam> var object then? |
18:33:19 | FromDiscord | <_alkamist_> I want to mutate the original source |
18:33:38 | FromDiscord | <_alkamist_> So you can patch in args from different places |
18:34:36 | FromDiscord | <heysokam> if your args are ref, you could get away with the object |
18:34:52 | FromDiscord | <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:13 | FromDiscord | <_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:41 | FromDiscord | <_alkamist_> I want to be able to have potentially long and cumbersome lists of arguments like that |
18:36:54 | FromDiscord | <_alkamist_> And I don't want to repeat them for every function that I write |
18:37:26 | FromDiscord | <_alkamist_> Essentially the user can provide the state |
18:37:28 | FromDiscord | <graveflo> it seems to me like you want an abstraction of objects then |
18:37:43 | FromDiscord | <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:52 | FromDiscord | <Yardanico> you still need to specify the arg name, but you won't have to repeat the type each time |
18:38:04 | FromDiscord | <_alkamist_> Yeah I'm thinking using might work potentially |
18:38:08 | FromDiscord | <Yardanico> otherwise create a pragma macro or something, or just use objects |
18:38:23 | FromDiscord | <_alkamist_> The problem with objects is that you have to copy the values |
18:38:37 | FromDiscord | <_alkamist_> Unless the object holds pointers, which seems weird |
18:38:37 | FromDiscord | <heysokam> objects can contain ref values |
18:38:50 | FromDiscord | <_alkamist_> I don't want to limit mutations to ref values |
18:38:51 | FromDiscord | <Yardanico> In reply to @_alkamist_ "The problem with objects": if you want to mutate, use `var x` or ref objects |
18:38:57 | FromDiscord | <Yardanico> `var T` works as well |
18:39:32 | FromDiscord | <_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:01 | FromDiscord | <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:26 | FromDiscord | <_alkamist_> Maybe I can try to make an example |
18:42:43 | FromDiscord | <rongcuid> I wonder. Is there an ETA for 2.0? |
18:44:08 | FromDiscord | <heysokam> In reply to @rongcuid "I wonder. Is there": when its done |
18:44:16 | FromDiscord | <_alkamist_> sent a code paste, see https://play.nim-lang.org/#ix=4zt0 |
18:45:14 | FromDiscord | <Yardanico> the user should store those variables in the same object as well |
18:45:22 | FromDiscord | <Yardanico> you can expose the type for the user to use |
18:45:36 | FromDiscord | <graveflo> it's weird that you want the mutual state-fullness to not be encapsulated. |
18:45:47 | FromDiscord | <_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:20 | FromDiscord | <_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:32 | FromDiscord | <graveflo> why not have the user acquire the info they need from the ui elements instead of of juggling around loose variables? |
18:47:21 | FromDiscord | <_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:28 | FromDiscord | <graveflo> it seems like you are trying to do something that is like having an "out" parameter in C? |
18:47:34 | FromDiscord | <_alkamist_> Yeah essentially |
18:47:50 | FromDiscord | <_alkamist_> But potentially everything in the logic could be an out parameter |
18:48:04 | FromDiscord | <_alkamist_> and patched in from various places, so you don't have to worry about copies and keeping things synced up |
18:49:29 | FromDiscord | <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:13 | FromDiscord | <_alkamist_> It's not a super mature idea yet and I'm still figuring out if it's viable. |
18:50:28 | FromDiscord | <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:36 | FromDiscord | <graveflo> they shouldn't need to declare their own float, for example, if that data is managed by the UI element |
18:52:29 | FromDiscord | <_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:11 | FromDiscord | <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:29 | FromDiscord | <heysokam> ref objects sound a lot better from an api usability perspective, than this idea you mention |
18:54:39 | FromDiscord | <graveflo> you can generate spring-board procs that patch the values into the object I guess. idk |
18:55:05 | FromDiscord | <heysokam> (edit) "mention" => "mentionβ΅at least from my superficial understanding of it, of course" |
18:55:09 | FromDiscord | <_alkamist_> I have made great progress using ref objects, it is definitely a good approach, I'm just exploring this idea. |
18:55:24 | FromDiscord | <heysokam> makes sense |
18:56:05 | FromDiscord | <_alkamist_> I'm almost trying to see if it's possible to encapsulate behavior completely in functions. |
18:56:36 | FromDiscord | <_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:53 | FromDiscord | <_alkamist_> Also interesting state can be returned from functions. |
18:59:23 | FromDiscord | <graveflo> well you definitely can encapsulate behavior only in functions |
19:00:05 | FromDiscord | <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:02 | FromDiscord | <_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:42 | FromDiscord | <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:06 | FromDiscord | <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:09 | FromDiscord | <_alkamist_> I suppose that is a concern, I hadn't really thought about that much. |
19:05:40 | FromDiscord | <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:47 | FromDiscord | <_alkamist_> Yeah the template I posted doesn't actually work, it was just to showcase the idea. |
19:07:29 | FromDiscord | <graveflo> you can generate signatures in a macro. I think the template might not be dynamic enough to do it |
19:08:06 | FromDiscord | <_alkamist_> Yeah macros would be a last resort for me because I struggle with them every time I try to write them. |
19:53:20 | FromDiscord | <Elegantbeef> @_alkamist_\: why not use a `ref float`? |
19:53:24 | FromDiscord | <Elegantbeef> Or `ptr float` if you want low level |
19:55:08 | FromDiscord | <_alkamist_> In reply to @Elegantbeef "<@277645179115143178>\: why not use": Like an object filled with ref arguments? |
19:55:16 | FromDiscord | <_alkamist_> (edit) "arguments?" => "fields?" |
19:56:07 | FromDiscord | <Elegantbeef> Of course |
19:56:09 | FromDiscord | <_alkamist_> And yeah pointers could be used but then the user is exposed to that. |
19:56:22 | FromDiscord | <Elegantbeef> Alternatively use generics + concepts |
19:56:34 | FromDiscord | <Elegantbeef> Consider looking at my gui 'framework' |
19:56:46 | FromDiscord | <Elegantbeef> https://github.com/beef331/gooey/ |
19:56:55 | FromDiscord | <_alkamist_> I have looked at it, my IQ isn't high enough to understand. |
19:57:17 | FromDiscord | <Elegantbeef> I just use closure procedures |
19:57:32 | FromDiscord | <Elegantbeef> `onChange = proc(f: float32) = myFloat = f` |
19:58:33 | FromDiscord | <_alkamist_> I'm persuing a more immediate mode approach at the moment, not sure if I'll stick with it. |
19:59:01 | FromDiscord | <_alkamist_> (edit) "persuing" => "pursuing" |
19:59:43 | FromDiscord | <Elegantbeef> Well if you're doing immediate just do what dearimgui does and take in a `f: float32` |
19:59:43 | FromDiscord | <Elegantbeef> `f: var float32` |
20:01:00 | FromDiscord | <_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:36 | FromDiscord | <_alkamist_> And thinking of GUI elements as a collection of arguments to a function. |
20:01:50 | FromDiscord | <Elegantbeef> That doesnt sound immediate π |
20:02:15 | FromDiscord | <Elegantbeef> You could use the best generic data type the humble `tuple` |
20:03:06 | FromDiscord | <_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:25 | FromDiscord | <Elegantbeef> I mean `proc doThing(myGui: var tuple)` |
20:04:14 | FromDiscord | <_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:55 | FromDiscord | <Elegantbeef> Right but to mutate the stored object you do not want immediate |
20:04:55 | FromDiscord | <Elegantbeef> You're trying to get immediate gui without the immediacy |
20:05:30 | FromDiscord | <Elegantbeef> You either need to use `ptr T`, `ref T`, or closures |
20:05:45 | FromDiscord | <_alkamist_> I guess I don't know what the definition of immediate is then in this case. |
20:06:32 | FromDiscord | <_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:46 | FromDiscord | <Elegantbeef> Right so like dearimgui |
20:06:58 | FromDiscord | <_alkamist_> Yeah |
20:07:07 | FromDiscord | <Elegantbeef> Then you do what they do and use `var T` |
20:07:17 | FromDiscord | <Elegantbeef> You want flow control to be explicit so you make it explicit to use |
20:07:46 | FromDiscord | <Elegantbeef> You cannot make a tuple of UI elements cause UI elements are not really existential and are just procedures |
20:08:40 | FromDiscord | <_alkamist_> We may have just gone in a circle. |
20:08:46 | FromDiscord | <_alkamist_> In reply to @Elegantbeef "Then you do what": This is what I want |
20:09:28 | FromDiscord | <_alkamist_> But the problem is, then you can't conveniently pass arguments to a function if the list of arguments is long. |
20:09:42 | FromDiscord | <Elegantbeef> Right this is the down side of imgui π |
20:09:43 | FromDiscord | <_alkamist_> And you have to repeat argument signatures for all of the functions |
20:10:02 | FromDiscord | <_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:17 | FromDiscord | <Elegantbeef> Imguis are extremely awkward to use, they're direct, but awkward |
20:10:38 | FromDiscord | <_alkamist_> Well what I am doing is exploring ways to try to make it less awkward. |
20:11:04 | FromDiscord | <_alkamist_> I have made some decent progress, with refs. |
20:11:31 | FromDiscord | <_alkamist_> I'm still experimenting though, and I'm thinking the var argument thing might be a dead end, not sure. |
20:13:12 | FromDiscord | <_alkamist_> Whenever I get into experimenting with gui logic I keep finding myself wanting to subvert the type system. No idea why. |
20:14:00 | FromDiscord | <Elegantbeef> No clue I really like the declarative style I have |
20:14:06 | FromDiscord | <Elegantbeef> So much nicer than dicking around with flow control |
20:15:46 | FromDiscord | <_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:21 | FromDiscord | <_alkamist_> The way I've been doing things currently, they come into being when they are reached. |
20:17:27 | FromDiscord | <Elegantbeef> I mean that's how imguis work |
20:18:39 | FromDiscord | <_alkamist_> Yeah, but I think the idea can be refined more. |
20:19:46 | FromDiscord | <_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:56 | FromDiscord | <_alkamist_> (edit) "All of the imguis ... have" added "I have seen" |
20:26:06 | FromDiscord | <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:23 | FromDiscord | <Elegantbeef> As such it's just easier to represent it as a tree |
20:27:16 | FromDiscord | <_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:51 | FromDiscord | <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:43 | FromDiscord | <_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:32 | FromDiscord | <Elegantbeef> Well I have no issue contributing ideas to another gui framework π |
20:29:56 | FromDiscord | <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:03 | FromDiscord | <Elegantbeef> My gui is quite large π |
20:34:25 | FromDiscord | <_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:31 | FromDiscord | <_alkamist_> It works on windows and webassembly but you would need to get my oswindow library too. |
20:35:47 | FromDiscord | <Elegantbeef> Well then it doesnt work |
20:36:48 | FromDiscord | <_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:19 | FromDiscord | <Elegantbeef> Right sounds like you should've just used sdl2 or gflw or windy π |
20:38:00 | FromDiscord | <_alkamist_> I have weird constraints that those libraries don't take into account. |
20:38:30 | FromDiscord | <Elegantbeef> I mean your GUI shouldnt rely on a backend |
20:39:01 | FromDiscord | <_alkamist_> The GUI logic itself doesn't rely on the backend |
20:39:07 | FromDiscord | <_alkamist_> You could bind it to another one. |
20:39:23 | FromDiscord | <Elegantbeef> In user code or by forking? |
20:39:28 | FromDiscord | <_alkamist_> user code. |
20:40:43 | FromDiscord | <Elegantbeef> What are the weird constraints anyway? |
20:41:46 | FromDiscord | <_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:15 | FromDiscord | <_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:27 | FromDiscord | <Zoom> @_alkamist_\: thanks for your Reaper SDK bindings, btw. Do you plan to maintain them? |
20:43:38 | * | junaid_ joined #nim |
20:44:51 | FromDiscord | <Elegantbeef> Arent you just describing faux windows, or does it create multiple real windows? |
20:46:28 | FromDiscord | <_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:54 | FromDiscord | <_alkamist_> In reply to @Elegantbeef "Arent you just describing": Real windows that get embedded. |
20:47:09 | FromDiscord | <_alkamist_> Like real operating system windows. |
20:48:39 | FromDiscord | <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:25 | FromDiscord | <_alkamist_> I just found it easier to do it myself, most windowing libraries have random behavior I find annoying. |
20:52:26 | FromDiscord | <_alkamist_> There's this dumb issue on windows where if you grab or resize a window it freezes the processing. |
20:53:06 | FromDiscord | <_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:24 | FromDiscord | <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:30 | FromDiscord | <_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:27 | FromDiscord | <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:08 | FromDiscord | <_alkamist_> In reply to @Zoom "I'm interested in the": I appreciate it! |
22:10:06 | NimEventer | New thread by PMunch: RIP Nitter, see https://forum.nim-lang.org/t/10313 |
22:29:42 | FromDiscord | <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:31 | FromDiscord | <Elegantbeef> I think I can reproduce an issue, get a binary string for `oldJson` |
22:33:18 | FromDiscord | <simonkrauter> ok, yes, sometimes it contains non-printable characters. thanks. |
22:33:40 | * | flouer joined #nim |
22:36:04 | FromDiscord | <Elegantbeef> I'd suggest to use `std/json` over `std/marshal` |
22:36:27 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/qVjlo |
22:36:28 | FromDiscord | <Elegantbeef> Or atleast I think π |
22:37:10 | FromDiscord | <Elegantbeef> This does seem to be a `std/marshal` bug, I still am lost why that module exists |
22:38:50 | FromDiscord | <simonkrauter> Ok, this is useful information, can you add it as comment to the github issue? |
22:42:25 | FromDiscord | <simonkrauter> I have added the information, that it's related to std/marshal. |
22:42:43 | FromDiscord | <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 |