00:05:36 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "Idk if there's a": mostly preference |
00:05:51 | FromDiscord | <sOkam! 🫐> i personally really dislike being tied to a cpp compiler, given how slow they are |
00:06:04 | FromDiscord | <sOkam! 🫐> but that would change per person, i can imagine |
00:07:12 | FromDiscord | <sOkam! 🫐> @.aingel. how does your C api look like? and how does your bindings for that api look like too? |
00:07:26 | FromDiscord | <sOkam! 🫐> (edit) "does" => "do" |
00:09:34 | FromDiscord | <sOkam! 🫐> also, you might find this bit of code useful:↵https://github.com/DanielBelmes/vulkan/blob/7d24715dffb42895f69c4c9376f52b640372bbaa/src/vulkan.nim#L11-L25 |
00:13:27 | FromDiscord | <.aingel.> In reply to @heysokam "<@1152336447467163790> how does your": It's nothing complicated pretty basic |
00:16:37 | FromDiscord | <.aingel.> Soo I should be able to use dylib to create a link between my cpp wrapped library and another nim project which is using the c backend right |
00:19:10 | FromDiscord | <.aingel.> Idk if that even makes sense |
00:19:18 | FromDiscord | <.aingel.> I think I should just staticly link the shared library |
00:36:05 | * | lumo_e quit (Quit: Quit) |
00:45:13 | FromDiscord | <sOkam! 🫐> yeah, its one way |
00:45:24 | FromDiscord | <sOkam! 🫐> you can also link statically, but the setup is different |
00:45:39 | FromDiscord | <sOkam! 🫐> and since you were having issues with that, i figured you should know that it is not the only option |
00:51:47 | FromDiscord | <.aingel.> In reply to @heysokam "you can also link": People are saying that macOS doesn't really support statically linking executables |
00:51:57 | FromDiscord | <.aingel.> But I am not sure if that applies here |
00:52:10 | FromDiscord | <.aingel.> I'm getting confused |
00:52:35 | FromDiscord | <.aingel.> In reply to @heysokam "and since you were": What is the other option? |
00:53:59 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "People are saying that": what? how does that work? |
00:55:27 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "What is the other": 1. dynamic link and distribute the cpp library as a dylib/so/dll↵2. static link and create a C api that wraps the cpp code, and create a nim wrapper for that C code↵3. static link and create an importcpp wrapper directly, but be tied to the cpp backend |
00:57:58 | FromDiscord | <odexine> https://developer.apple.com/forums/thread/706419?answerId=714469022#714469022 |
00:58:16 | FromDiscord | <odexine> In macOS there is no static library for kernel access |
00:58:32 | FromDiscord | <odexine> And system calls are not guaranteed to be stable |
00:59:07 | FromDiscord | <odexine> So there is at least 1 dynamic library to be linked at all times |
01:01:43 | FromDiscord | <sOkam! 🫐> i don't understand the details of that, but im 100% static linking on mac (and building -from- mac) with nglfw and with wgpu, and it works↵so im not quite sure how much that applies to aingel's case |
01:01:57 | FromDiscord | <odexine> Basically you can static link libraries |
01:02:08 | FromDiscord | <sOkam! 🫐> but his code is a library, isn't it |
01:02:08 | FromDiscord | <odexine> You just can’t have a completely statically linked binary |
01:02:12 | FromDiscord | <odexine> Yes |
01:02:19 | FromDiscord | <odexine> I’m just explaining what they said |
01:02:31 | FromDiscord | <sOkam! 🫐> ah kk |
01:03:09 | FromDiscord | <my.narco> hmm should i have my parser walk through a BinOp node and calculate it before interpretation? Or have my vm do it? |
01:09:39 | FromDiscord | <raynei486> optimization is not really the parser's job |
01:10:25 | FromDiscord | <.aingel.> In reply to @heysokam "1. dynamic link and": So what I need to static or dynamic link against is just the c++ stl |
01:10:32 | FromDiscord | <.aingel.> The other code is just cpp |
01:11:32 | FromDiscord | <.aingel.> I already have a c api for the cpp code and nim wrapper for the C code, the issue is that the cpp code needs the cpp stl |
01:16:37 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "I already have a": then link to the stl when building that part of the code |
01:20:50 | FromDiscord | <.aingel.> In reply to @heysokam "then link to the": Ya thats what I'm doing but having issues |
01:21:01 | FromDiscord | <.aingel.> g++-13 -fPIC -shared -o libjson.so cysimdjsonc.cpp simdjson.cpp -static-libstdc++ -static-libgcc |
01:21:18 | FromDiscord | <.aingel.> I'm doing this and it seems to build the dynamic library properly |
01:21:23 | FromDiscord | <.aingel.> It's large |
01:21:28 | FromDiscord | <.aingel.> Maybe i'll write some c just to test it |
01:30:17 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "Maybe i'll write some": definitely do that |
01:32:00 | FromDiscord | <sOkam! 🫐> also, are you sure you need to static-link to stdcpp, and not just `-lstdc++`? 🤔↵don't know about that one, but personally I would first go for dynamic linking, since its gonna be rare to find a system that doesn't provide that, afaik |
01:33:06 | FromDiscord | <.aingel.> My c isn't working either trying to use just a basic lib that I make and dym linking it |
01:33:11 | FromDiscord | <sOkam! 🫐> _(btw, this fkery is why I avoid cpp stuff like the plague, its always a mess)_ |
01:33:14 | FromDiscord | <.aingel.> I can't use -lstdc++ with the c compiler |
01:33:39 | FromDiscord | <.aingel.> Thats why I'm statically linking stdc++ |
01:33:48 | FromDiscord | <sOkam! 🫐> ic |
01:33:49 | FromDiscord | <.aingel.> Otherwise any nim I use will have to be with the cpp backend |
01:34:11 | FromDiscord | <sOkam! 🫐> makes sense |
01:46:11 | FromDiscord | <.aingel.> Oh i think it has somehting to do with extern "c" |
01:47:48 | FromDiscord | <.aingel.> Yooooo |
01:47:52 | FromDiscord | <.aingel.> I think it wokred |
01:48:08 | FromDiscord | <.aingel.> (edit) "wokred" => "worked" |
01:48:11 | FromDiscord | <.aingel.> Well at least it built |
01:48:23 | FromDiscord | <.aingel.> Or linked rather |
01:51:05 | Amun-Ra | that disables name mangling for the function |
01:54:28 | FromDiscord | <my.narco> In reply to @raynei486 "optimization is not really": fair |
01:54:44 | FromDiscord | <.aingel.> In reply to @Amun-Ra "that disables name mangling": Yeah |
03:46:23 | * | qwestion joined #nim |
05:22:45 | * | rockcavera quit (Remote host closed the connection) |
05:56:39 | FromDiscord | <Chronos [She/Her]> https://github.com/Nimberite-Development/ModernNet woot woot finally got docs deployed |
05:56:47 | FromDiscord | <Chronos [She/Her]> I also modified the Action a bit :p |
06:02:10 | * | disso-peach joined #nim |
06:11:14 | * | disso-peach quit (Quit: Leaving) |
06:13:06 | FromDiscord | <nnsee> In reply to @chronos.vitaqua "https://github.com/Nimberite-Development/ModernNet ": heh, you might find this interesting, i've been working on a server for minecraft classic (0.30) https://git.dog/xx/fastcube |
06:13:32 | FromDiscord | <nnsee> currently quite spaghetti, will clean it up and then start implementing the Classic Protocol Extensions |
06:18:56 | * | junaid_ joined #nim |
06:19:00 | FromDiscord | <nnsee> all 36 of them: https://git.dog/xx/fastcube/milestone/1 |
06:19:58 | * | junaid__ joined #nim |
06:20:00 | * | junaid__ quit (Client Quit) |
06:28:28 | * | blop_ quit (Remote host closed the connection) |
06:29:05 | * | blop_ joined #nim |
06:30:14 | FromDiscord | <Chronos [She/Her]> Oh epic! |
06:33:32 | FromDiscord | <Chronos [She/Her]> I didn't implement any support for the classic protocol mostly because I saw no reason to, tbh |
06:33:53 | * | azimut quit (Ping timeout: 252 seconds) |
06:34:20 | FromDiscord | <Chronos [She/Her]> I originally wanted to implement a 1.19 server, and now someone is using the unpolished library for a 1.7 server which is nice :) |
06:39:47 | * | advesperacit joined #nim |
06:43:56 | madprops | how would you remove all empty strings in a seq[string] from the start and end of the array, like a sort of strip ? |
06:44:26 | madprops | similarly, how would you remove multiple empty strings into a single one |
06:46:06 | termer | var res = newSeq[string]() |
06:46:14 | termer | for str in sourceSeq: |
06:46:21 | termer | if str != "": |
06:46:26 | termer | res.add(str) |
06:46:44 | madprops | there can be empty lines in the middle |
06:46:46 | madprops | but not multiple of them |
06:47:18 | termer | https://nim-lang.org/docs/strutils.html#isEmptyOrWhitespace%2Cstring |
06:47:31 | termer | Not sure if I understand what you need, but this module will probably be helpful to you |
07:03:14 | FromDiscord | <dissolved.girl> madprops: You can probably more or less copy the logic from strutils.strip: https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/strutils.nim#L2889 |
07:03:58 | madprops | ended up doing this https://i.imgur.com/HFlV7a3.jpg |
07:04:05 | madprops | i didn't want to turn it into a string and applying regex or similar |
07:04:11 | madprops | i think it's faster in the array directly |
07:04:55 | madprops | that's code basically generated by chatgpt |
07:05:08 | FromDiscord | <dissolved.girl> That looks an awful lot like the link I posted |
07:05:16 | FromDiscord | <dissolved.girl> Except with some extra logic |
07:06:32 | FromDiscord | <nnsee> In reply to @chronos.vitaqua "I didn't implement any": classic has a very special place in my heart, it's where i made my first actual friends on the internet (some of whom I'm still in contact with) |
07:06:52 | FromDiscord | <nnsee> i was an admin on Minecraft Forums back then as well |
07:07:06 | FromDiscord | <nnsee> and hosted a Classic server |
07:07:41 | FromDiscord | <nnsee> i was playing minecraft and hosting servers wayyy before it ever got popular, I remember when the server list had like 30 servers or so |
07:09:19 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "I originally wanted to": 1.7 best version for me |
07:11:11 | FromDiscord | <nnsee> In reply to @nnsee "i was playing minecraft": okay, maybe like a hundred |
07:12:01 | FromDiscord | <nnsee> https://web.archive.org/web/20090711155805/http://www.minecraft.net:80/servers.jsp this is very, very nostalgic for me (and includes my server :) ) |
07:18:52 | FromDiscord | <Chronos [She/Her]> In reply to @nnsee "classic has a very": Understandable, for me I was literally 6 when MC first released lmao, and I got spoiled with newer versions, I used to swear by 1.12.2 aha |
07:19:02 | FromDiscord | <Chronos [She/Her]> In reply to @griffith1deadly "1.7 best version for": Fair |
07:19:24 | FromDiscord | <Chronos [She/Her]> I am old enough to remember pocket edition on the iPhone tho |
07:19:28 | FromDiscord | <Chronos [She/Her]> That was so great |
07:31:34 | FromDiscord | <griffith1deadly> i start playing minecraft in 1.5.2 release for java edition aha |
07:40:46 | FromDiscord | <Chronos [She/Her]> Oh nice! I never even had a computer as a kid either lol |
07:58:01 | * | dza quit (Quit: ) |
07:59:35 | * | dza joined #nim |
08:00:11 | * | PMunch joined #nim |
08:57:53 | * | junaid_ quit (Remote host closed the connection) |
09:20:10 | * | PMunch_ joined #nim |
09:23:09 | * | PMunch quit (Ping timeout: 258 seconds) |
09:25:33 | * | dza quit (Quit: ) |
09:45:21 | * | dza joined #nim |
09:51:02 | * | dza quit (Quit: ) |
10:05:52 | * | PMunch_ is now known as PMunch |
10:10:39 | * | Guest24 joined #nim |
10:12:19 | * | Guest24 quit (Client Quit) |
10:23:34 | NimEventer | New Nimble package! modernnet - ModernNet is a barebones library to interact with the Minecraft Java Edition protocol!, see https://github.com/Nimberite-Development/ModernNet |
10:48:16 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4I39 |
10:59:00 | FromDiscord | <demotomohiro> I cannot read these error message. |
11:02:56 | FromDiscord | <Phil> Je ne parles pas francais |
11:03:24 | FromDiscord | <demotomohiro> I guess, if you compile some program that uses some library or windows API but you didn't add correct libraries to link option, it is normal to get errors like "`foobar` is undefined reference." |
11:07:52 | PMunch | System64_~_Flandre_Scarlet, yeah that's a normal error stemming from linking issues |
11:08:32 | PMunch | Basically you tell your program that some symbol like `imp_DragQueryFileW` should be available, but nothing during your linking step actually introduces said symbol. |
11:18:52 | FromDiscord | <kcvinker5420> sent a code paste, see https://play.nim-lang.org/#ix=4I3c |
11:19:48 | FromDiscord | <xtrayambak> How can you disable compiler warnings for a specific proc? |
11:20:00 | FromDiscord | <dissolved.girl> Probably the push and pop pragmas |
11:20:17 | FromDiscord | <xtrayambak> Oh yeah, those exist |
11:20:18 | FromDiscord | <xtrayambak> Thanks |
11:23:51 | * | krux02 joined #nim |
11:59:09 | FromDiscord | <.aingel.> Can i get nim to use g++ instead of clang++ |
11:59:33 | FromDiscord | <.aingel.> Or rather gcc instead of the clnag |
11:59:35 | FromDiscord | <.aingel.> (edit) "clnag" => "clang" |
12:00:26 | FromDiscord | <odexine> It uses GCC by default though? |
12:05:27 | FromDiscord | <.aingel.> @odexine on macos it uses the mac "Gcc" |
12:05:44 | FromDiscord | <.aingel.> Which is clnag |
12:05:46 | FromDiscord | <.aingel.> (edit) "clnag" => "clang" |
12:16:12 | FromDiscord | <sOkam! 🫐> @.aingel. https://nim-lang.org/docs/nimc.html#compiler-selection |
12:17:15 | FromDiscord | <sOkam! 🫐> a more involved case of that functionality being used can be found here https://github.com/enthus1ast/zigcc |
12:18:24 | FromDiscord | <sOkam! 🫐> tldr: `--cc:thecompiler` and all its relevant options must be configured for your alternate compiler |
12:20:18 | FromDiscord | <dissolved.girl> In reply to @.aingel. "<@259277943275126785> on macos it": Can't you just set the `gcc` binary to just point to (the actual) `gcc`? |
12:20:37 | FromDiscord | <dissolved.girl> I think Nim simply takes it from the PATH |
12:21:09 | FromDiscord | <dissolved.girl> So you can create a `gcc` -> [the real gcc] symlink somewhere and prepend that directory to your PATH variable |
12:21:26 | FromDiscord | <sOkam! 🫐> that might break other parts of their system, if they rely on gcc being clang |
12:21:45 | FromDiscord | <dissolved.girl> I'm not suggesting they change the system PATH |
12:21:50 | FromDiscord | <dissolved.girl> Just for their use case |
12:21:58 | FromDiscord | <dissolved.girl> A wrapper script that calls Nim or whatever |
12:22:14 | FromDiscord | <sOkam! 🫐> yeah i know, just saying that "my-computer-specific" changes are brittle to say the least |
12:22:43 | FromDiscord | <sOkam! 🫐> `nim.cfg` can be setup for compiler selection config, which is part of what is made for |
12:23:40 | FromDiscord | <dissolved.girl> _Where_ is the real gcc anyways on a macOS system? |
12:23:53 | FromDiscord | <dissolved.girl> It's GNU, so you probably have to install it via brew? |
12:25:23 | FromDiscord | <.aingel.> In reply to @dissolved.girl "Can't you just set": Yeah I tried doing this well... I set an alias but I don't think it really worked |
12:25:33 | FromDiscord | <.aingel.> In reply to @dissolved.girl "_Where_ is the real": yeah it's like gcc-13 |
12:25:38 | FromDiscord | <.aingel.> That's the name it's installed under |
12:25:44 | FromDiscord | <sOkam! 🫐> seems to go to `/usr/bin/gcc-10` and similars |
12:25:50 | FromDiscord | <.aingel.> Maybe the alias in my zshrc doesn't pick up for nim? |
12:26:03 | FromDiscord | <dissolved.girl> In reply to @.aingel. "Yeah I tried doing": Alias is a shell-only construct |
12:26:11 | FromDiscord | <dissolved.girl> It doesn't propagate to spawned child processes |
12:26:12 | FromDiscord | <sOkam! 🫐> @.aingel. or its just nameclashing with the clang version, and not accepting it |
12:26:19 | FromDiscord | <dissolved.girl> Only the shell is aware of it |
12:26:20 | FromDiscord | <.aingel.> Right @dissolved.girl thought so |
12:26:51 | FromDiscord | <sOkam! 🫐> oh you aliased it? yeah that would be it |
12:26:53 | FromDiscord | <.aingel.> So @sOkam! 🫐 .. right now I was able to build a shared library with clang++ (mac) and get it to dynamically link with nim's c compiler (clang mac) |
12:27:26 | FromDiscord | <.aingel.> Without even doing static.. I got some sort of static thing to work but doesn't seem to actually increase the shared library file, it also seems to indicate it's still being linked to libc++ |
12:27:35 | FromDiscord | <.aingel.> But somehow it works with the c compiler now.. |
12:27:43 | FromDiscord | <.aingel.> Is this a sustainable way of doing things? |
12:27:46 | FromDiscord | <sOkam! 🫐> neat! |
12:28:13 | FromDiscord | <.aingel.> My other alternative is to try and force everything to use gcc and see if it works |
12:28:16 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "Is this a sustainable": yeah, just that you need to distribute the dynamic library alongside your project |
12:28:37 | FromDiscord | <.aingel.> I thought i have to get nimble to build it |
12:28:38 | FromDiscord | <sOkam! 🫐> i find that annoying, so I try to static-link all i can |
12:28:41 | FromDiscord | <dissolved.girl> sent a code paste, see https://play.nim-lang.org/#ix=4I3H |
12:28:47 | FromDiscord | <sOkam! 🫐> but your usecase might be different |
12:28:51 | FromDiscord | <leorize> fwiw you shouldn't statically link system libraries like libc++ on macOS |
12:28:52 | FromDiscord | <sOkam! 🫐> nothing wrong with dynamic-link |
12:29:08 | FromDiscord | <.aingel.> In reply to @leorize "fwiw you shouldn't statically": Right |
12:29:15 | FromDiscord | <sOkam! 🫐> ah yeah, i never staticlink to the stdlib, great to mention |
12:29:29 | FromDiscord | <leorize> macOS is kinda similar to Windows in that they don't have a stable kernel-userspace ABI |
12:29:30 | FromDiscord | <.aingel.> So I have to get nimble to build before install right |
12:29:36 | FromDiscord | <.aingel.> Cause I figure it will be different for different systems |
12:30:20 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "So I have to": you are building a library that will use that code? |
12:30:28 | FromDiscord | <sOkam! 🫐> i thought it was for your project only |
12:30:47 | FromDiscord | <.aingel.> If it was just for my project I wouldn't mind using the nim cc compiler |
12:30:53 | FromDiscord | <sOkam! 🫐> i see |
12:30:55 | FromDiscord | <.aingel.> I am wrapping a c++ json library |
12:31:09 | FromDiscord | <.aingel.> And so I want people to be able to use it without having to be forced to use cc for their backend |
12:31:16 | FromDiscord | <.aingel.> Cause I think that would mess up a lot of things |
12:31:19 | FromDiscord | <.aingel.> Including myself |
12:31:26 | FromDiscord | <sOkam! 🫐> I found this very same issue with my wgpu bindings↵the only real solution, after trying everything (including nimble tasks, and all) was to just build it inside a `static: ...` block |
12:31:30 | FromDiscord | <.aingel.> I just want to be able to drop this into any proect I'm using |
12:32:05 | FromDiscord | <sOkam! 🫐> @.aingel. https://github.com/heysokam/wgpu/blob/master/src/wgpu/compile.nim this file, in a nutshell, its solving what you mention |
12:32:14 | FromDiscord | <sOkam! 🫐> but instead of using gcc is using rust compiler. same idea |
12:33:10 | FromDiscord | <.aingel.> Right I think that is similar |
12:33:17 | FromDiscord | <.aingel.> Is this a dynamic link though? |
12:33:18 | FromDiscord | <sOkam! 🫐> the essence of that is that it builds it from a static block, so it only happens once during compilation of your project↵aka the same as you would do with a nimble task, but instead of being brittle it works across systems |
12:33:32 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "Is this a dynamic": no, but dynamic-vs-static is just a matter of configuration options |
12:33:34 | FromDiscord | <.aingel.> Oh it's static, cause of -I |
12:33:36 | FromDiscord | <.aingel.> Yeah |
12:33:44 | FromDiscord | <.aingel.> I would be doing the same thing but dynamic I guess |
12:33:47 | FromDiscord | <sOkam! 🫐> yeah |
12:33:51 | FromDiscord | <.aingel.> How do I grab the shared library from nimble though |
12:34:00 | FromDiscord | <sOkam! 🫐> you don't |
12:34:05 | FromDiscord | <sOkam! 🫐> you build it, and link it from that file |
12:34:22 | FromDiscord | <.aingel.> I mean I want people to be able to use this library by using nimble |
12:34:32 | FromDiscord | <.aingel.> Like nimble install newJson and then be able to use that in their project |
12:34:36 | FromDiscord | <sOkam! 🫐> if you are not building it, then you just `link: ...` or `passL: -l...` etc |
12:34:40 | FromDiscord | <.aingel.> Not just import this for a one time thing for my project |
12:34:48 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "I mean I want": you can use my wgpu bindings using nimble |
12:35:05 | FromDiscord | <.aingel.> Which is what? |
12:35:12 | FromDiscord | <sOkam! 🫐> that file i linked |
12:35:57 | FromDiscord | <sOkam! 🫐> https://github.com/heysokam/wgpu/blob/45121038b0786ef00f764d5e72ff07343fb82b2c/src/wgpu.nim#L5-L6↵This makes it so that the user will compile the library with the external process whenever they `import wgpu` |
12:36:27 | FromDiscord | <.aingel.> Ah I see |
12:36:34 | FromDiscord | <sOkam! 🫐> that way they don't need to set it up all themselves, they just `import thelib` |
12:37:06 | FromDiscord | <sOkam! 🫐> the trick on your side is building into `nimcache`, instead of to the project's folder |
12:37:28 | FromDiscord | <sOkam! 🫐> https://github.com/heysokam/wgpu/blob/45121038b0786ef00f764d5e72ff07343fb82b2c/src/wgpu/compile.nim#L36 which is what this line is doing |
12:37:31 | FromDiscord | <.aingel.> nimcache of the lib's folder? |
12:37:46 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "nimcache of the lib's": nimcache is a global folder, and it is configurable by the user |
12:37:51 | FromDiscord | <.aingel.> Oh okay |
12:38:01 | FromDiscord | <.aingel.> Aren't there separate proj folders for nimcache |
12:38:09 | FromDiscord | <sOkam! 🫐> its where all of the `.c` and `.o` files from the nim compiler go |
12:38:12 | FromDiscord | <.aingel.> Where u see your generated c code |
12:38:16 | FromDiscord | <.aingel.> It's in folders per project no? |
12:38:23 | FromDiscord | <sOkam! 🫐> yeah, basically |
12:39:02 | FromDiscord | <sOkam! 🫐> but that's what you want, afaik. you want the user to output that library you are building into somewhere they can find easily |
12:39:19 | FromDiscord | <.aingel.> Ah okay |
12:39:24 | FromDiscord | <.aingel.> Will it have to build each time |
12:39:25 | FromDiscord | <sOkam! 🫐> and that works across systems. so thats what nimcache is |
12:39:28 | FromDiscord | <.aingel.> Or does it get cached |
12:39:41 | FromDiscord | <sOkam! 🫐> its cached, unless you erase the folder |
12:39:46 | FromDiscord | <.aingel.> Nice |
12:39:49 | FromDiscord | <.aingel.> That works perfectly |
12:39:50 | * | junaid_ joined #nim |
12:39:56 | FromDiscord | <.aingel.> I am glad this library is super cool |
12:40:02 | FromDiscord | <.aingel.> simdjson it's super fast json parsing |
12:40:12 | FromDiscord | <.aingel.> There are rust bindings but no nim |
12:40:42 | FromDiscord | <.aingel.> And python of course too but I feel like the python bindings are easier, cause they dont have to worry about two compilers |
12:40:46 | FromDiscord | <.aingel.> (c and c++ in this case) |
12:40:54 | FromDiscord | <.aingel.> I think rust is probably the same way |
12:42:54 | FromDiscord | <Chronos [She/Her]> Simdjson? |
12:43:33 | FromDiscord | <Chronos [She/Her]> When would you even need gigabytes of JSON data at a second's notice |
12:43:37 | FromDiscord | <sOkam! 🫐> @Chronos [She/Her] #neat https://media.discordapp.net/attachments/371759389889003532/1158746178318499941/image.png?ex=651d5df9&is=651c0c79&hm=184aeade22b5ece5cbb957b7e7fef00c9cbe50c824a3c928c06e9223a51ddbfe& |
12:44:44 | FromDiscord | <Chronos [She/Her]> Thanks :D↵I did make a few issues aha but I can fix them when home |
12:45:56 | FromDiscord | <sOkam! 🫐> need to get my docs ready too. i have the tasks setup and all, but i didn't figure out how to create the github page |
12:45:59 | FromDiscord | <.aingel.> In reply to @chronos.vitaqua "When would you even": Processing reddit logs |
12:46:09 | FromDiscord | <.aingel.> I have all the reddit logs from 2005-2023 it's like |
12:46:11 | FromDiscord | <Chronos [She/Her]> Hm |
12:46:22 | FromDiscord | <.aingel.> 10tb of data |
12:46:28 | FromDiscord | <sOkam! 🫐> jeez |
12:46:29 | FromDiscord | <.aingel.> simdjson makes a massive difference |
12:46:35 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "need to get my": You could check the workflow I'm using? Or the one treeform uses, mine modifies theirs slightly tho |
12:46:45 | FromDiscord | <Chronos [She/Her]> In reply to @.aingel. "simdjson makes a massive": Ah okay that makes much more sense aha |
12:46:53 | FromDiscord | <.aingel.> Ya haha |
12:47:13 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "You could check the": thats part of why its not done 🙈↵i don't want to be near github workflows and/or ci ⚰️ |
12:47:16 | FromDiscord | <Chronos [She/Her]> https://github.com/Nimberite-Development/ModernNet/blob/master/.github/workflows/docs.yml |
12:47:28 | FromDiscord | <Chronos [She/Her]> In reply to @heysokam "thats part of why": Rip |
12:47:34 | FromDiscord | <.aingel.> Also native c++ works a lot faster than the simdjson python bindings if oyu use -O3 |
12:47:46 | FromDiscord | <.aingel.> But thinking about it it's probably cause the bindings are not compiled iwth -O3 |
12:47:52 | FromDiscord | <sOkam! 🫐> will eventually figure it out, i just didn't find the mental energy for it i guess 😄 |
12:47:53 | FromDiscord | <.aingel.> But I bet it will be just as fast with nim |
12:48:29 | FromDiscord | <.aingel.> I think this should be faster than treeform's jsony which is the fastest json parser we have for nim right now |
12:48:42 | FromDiscord | <.aingel.> Although that is pure nim implementation |
12:48:49 | FromDiscord | <.aingel.> (edit) "Although that is ... pure" added "a" |
12:58:13 | FromDiscord | <dissolved.girl> In reply to @chronos.vitaqua "When would you even": Slightly unrelated, but this discussion reminded me of this blog post: https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times-by-70/ |
12:58:18 | FromDiscord | <dissolved.girl> About now _not_ to do JSON parsing |
13:05:32 | FromDiscord | <Chronos [She/Her]> That sounds hilarious xD |
13:06:01 | FromDiscord | <Chronos [She/Her]> Let us just port it to Nim /j |
13:30:05 | FromDiscord | <sOkam! 🫐> In reply to @dissolved.girl "Slightly unrelated, but this": really fun read |
13:32:35 | * | Mister_Magister quit (Ping timeout: 240 seconds) |
13:40:02 | * | junaid_ quit (Remote host closed the connection) |
13:46:31 | FromDiscord | <fowl.mouth> It used to take like 10 minutes to load the game |
13:53:22 | FromDiscord | <Chronos [She/Her]> This is GTA 5, right? |
13:53:47 | FromDiscord | <Chronos [She/Her]> I swear when I was younger, on PS4, singleplayer took multiple minutes to load |
14:00:28 | NimEventer | New post on r/nim by fyzic: Nim vs Rust vs Go vs Zig vs Crystal for data processing, see https://reddit.com/r/nim/comments/16ysox5/nim_vs_rust_vs_go_vs_zig_vs_crystal_for_data/ |
14:12:59 | PMunch | Anyone wants to go golfing? |
14:19:48 | FromDiscord | <Phil> Want is a strong word |
14:20:09 | PMunch | Not sure how they got 200ms, must be running on a super slow machine |
14:20:40 | PMunch | I compiled it and got ~70ms |
14:20:52 | PMunch | With LTO it dropped to ~50ms |
14:25:13 | FromDiscord | <Phil> What was the fastest way to read in a file again? |
14:25:37 | PMunch | It reads in the file before it starts the timer |
14:25:38 | FromDiscord | <Phil> I tend to just use open but I recall beef starting beef about that |
14:25:56 | FromDiscord | <nervecenter> KISS |
14:25:58 | FromDiscord | <Phil> In reply to @PMunch "It reads in the": Yeah I'm about to throw the book at this |
14:26:32 | FromDiscord | <nervecenter> I'd say try not to do anything magical, show that Nim can be fast while being easy to read and easy to use |
14:26:43 | FromDiscord | <nervecenter> That's my biggest problem with a lot of these exercises |
14:26:44 | FromDiscord | <Phil> Yeah but I recall open not being the greatest |
14:26:52 | FromDiscord | <nervecenter> the sources start to become write-only |
14:26:52 | FromDiscord | <Phil> In reply to @nervecenter "That's my biggest problem": These exercises are worthless by default |
14:26:57 | FromDiscord | <Phil> Literally always worthless |
14:27:03 | FromDiscord | <Phil> This is basically just about who can cheat the hardest imo |
14:27:40 | PMunch | This is the fastest I have so far: http://ix.io/4I47 |
14:27:48 | PMunch | Sub 50ms on my machine |
14:28:07 | FromDiscord | <Phil> I mean I just added -d:danger and -d:lto and already got under 50 |
14:28:10 | PMunch | Oops, that nimcall doesn't have to be there, it didn't make a difference |
14:28:18 | FromDiscord | <Phil> And that is without even jumping to jsony |
14:28:24 | PMunch | Well -d:danger isn't allowed as it says to not disable bounds checks |
14:28:38 | PMunch | Json parsing is also done before the timer starts, so that doesn't matter |
14:29:51 | FromDiscord | <Phil> Where does it say bounds checks are necessary? |
14:30:15 | PMunch | In the "Rules" section of the README: https://github.com/jinyus/related_post_gen/tree/main |
14:34:11 | PMunch | TBH I think this mostly just benchmarks the built in table implementation |
14:35:52 | * | PMunch quit (Quit: Leaving) |
14:40:01 | FromDiscord | <Phil> In reply to @PMunch "This is the fastest": You can get slightly faster if you use ref seq[int] instead of seq[int] to reduce some copies |
14:41:13 | FromDiscord | <jviega> Hey, I was thinking of wrapping my lock-free data structures in the not-too distant future. Two questions: 1) Is there any sort of static max on # of threads, etc. 2) Is incref atomic in refc (and orc I suppose)? Because if not, then I'm not sure it's worth doing at all, as it would require unnatural work to use anyway. |
14:43:00 | FromDiscord | <leorize> 1. no |
14:43:01 | FromDiscord | <leorize> 2. no |
14:43:04 | FromDiscord | <Phil> Given that all that benchmarks do is annoy me I'll leave that one overall to you Pmunch |
14:43:07 | FromDiscord | <ringabout> > Is incref atomic in refc (and orc I suppose)Is incref atomic in refc (and orc I suppose)↵It's not. You are supposed to use `shared pointer` or `--mm:atomicArc` |
14:44:17 | FromDiscord | <leorize> 2. no |
14:44:47 | FromDiscord | <odexine> why'd you send that 2nd one twice |
14:47:12 | NimEventer | New thread by ITwrx: Related_post_gen benchmark, see https://forum.nim-lang.org/t/10525 |
14:47:30 | * | Mister_Magister joined #nim |
14:52:14 | FromDiscord | <Chronos [She/Her]> In reply to @NimEventer "New post on r/nim": https://github.com/simdjson/simdjson#bindings-and-ports-of-simdjson imagine porting/binding this in Nim just for the challenge- |
14:52:46 | FromDiscord | <saint._._.> In reply to @PMunch "It reads in the": Do we have to use the standard json lib? |
14:52:54 | FromDiscord | <saint._._.> I’m sure using another json lib will get it faster |
14:53:05 | FromDiscord | <saint._._.> In reply to @chronos.vitaqua "https://github.com/simdjson/simdjson#bindings-and-p": That’s literally what i’ve done haha |
14:53:19 | FromDiscord | <saint._._.> Oh on my other account |
14:53:28 | FromDiscord | <Chronos [She/Her]> Pmunch just said that the JSON Nim doesn't matter at all here |
14:53:34 | FromDiscord | <saint._._.> Oh ok |
14:54:01 | FromDiscord | <Chronos [She/Her]> Json parsing |
14:55:59 | * | arkanoid joined #nim |
15:04:00 | * | Mister_Magister quit (Ping timeout: 272 seconds) |
15:16:58 | * | def- quit (Quit: -) |
15:18:32 | * | def- joined #nim |
15:29:27 | * | Mister_Magister joined #nim |
15:40:13 | * | Mister_Magister quit (Ping timeout: 252 seconds) |
15:41:35 | * | azimut joined #nim |
15:41:37 | * | Mister_Magister joined #nim |
16:01:58 | * | Mister_Magister quit (Ping timeout: 255 seconds) |
16:08:39 | * | Mister_Magister joined #nim |
16:11:01 | FromDiscord | <diogenesoftoronto> In reply to @ringabout "> Is incref atomic": I was about to say woah nim has shared pointers but then again nim has almost everything so maybe I shouldn't be surprised |
16:11:45 | NimEventer | New post on r/nim by Kiloneie: Nim for Beginners Sets, see https://reddit.com/r/nim/comments/16yw157/nim_for_beginners_sets/ |
16:41:18 | FromDiscord | <ezquerra> In reply to @NimEventer "New post on r/nim": Are they compiling with the default options? If so they are compiling in debug mode, aren't they? |
16:52:03 | FromDiscord | <michaelb.eth> In reply to @ezquerra "Are they compiling with": nah, it's compiled with `-d:release` |
16:58:49 | FromDiscord | <my.narco> hooray! https://media.discordapp.net/attachments/371759389889003532/1158810400452771840/image.png?ex=651d99c9&is=651c4849&hm=7541743b03b4ca869a8f73739c88877156a84e2afd6126a04f2449597f9cb9dd& |
17:00:03 | FromDiscord | <.aingel.> What is this syntax? ↵`sh &"cargo build --target-dir {trgDir}", wgpuDir` |
17:00:14 | FromDiscord | <.aingel.> `proc sh (cmd :string; dir :string= "") :void=` |
17:00:40 | FromDiscord | <.aingel.> you can pass arguments without brackets? |
17:00:47 | FromDiscord | <.aingel.> What does the & at the beginning of the string do? |
17:00:57 | FromDiscord | <nervecenter> `&` is string interpolation |
17:01:09 | FromDiscord | <nervecenter> `{trgDir}` gets stringified and dropped in |
17:01:49 | FromDiscord | <nervecenter> The function signature is just weird spacing, I'd do `proc sh (cmd: string, dir: string = ""): void =` |
17:01:57 | FromDiscord | <nervecenter> (edit) "sh (cmd:" => "sh(cmd:" |
17:02:07 | FromDiscord | <.aingel.> Oh right thanks |
17:02:18 | FromDiscord | <nervecenter> The first line is a call to sh, yes you can forego brackets |
17:02:30 | FromDiscord | <nervecenter> Same as `sh(&"cargo build --target-dir {trgDir}", wgpuDir)` |
17:02:43 | FromDiscord | <.aingel.> I have been using fmt so I didnt recognize the & |
17:02:52 | FromDiscord | <nervecenter> `&` is generally better |
17:02:58 | FromDiscord | <.aingel.> u can do ; instead of , for parameters? |
17:03:02 | FromDiscord | <.aingel.> In a proc definition? |
17:03:05 | FromDiscord | <.aingel.> In reply to @nervecenter "`&` is generally better": gotcha |
17:03:58 | FromDiscord | <nervecenter> In reply to @.aingel. "u can do ;": Yes and sometimes you need to if you want to define multiple parameters of one type, for example↵`proc sample(string1, string2, string3: string; int1, int2: int)` |
17:04:11 | FromDiscord | <.aingel.> Gotcha |
17:04:14 | FromDiscord | <nervecenter> `;` is the safest parameter separator if you ever run into issues |
17:04:19 | FromDiscord | <.aingel.> Interesting |
17:04:35 | FromDiscord | <.aingel.> Is there a diff between gorgeEx and execshellcmd |
17:05:16 | FromDiscord | <nervecenter> `gorgeEx` docs say:↵> This is an alias for staticExec. |
17:05:28 | FromDiscord | <nervecenter> https://nim-lang.org/docs/system.html#gorgeEx%2Cstring%2Cstring%2Cstring |
17:05:39 | FromDiscord | <nervecenter> Sorry, Ex includes the exit code |
17:05:41 | FromDiscord | <.aingel.> Yeah |
17:05:51 | FromDiscord | <.aingel.> I guess I dont get what it means by the compile time stuff |
17:06:03 | FromDiscord | <.aingel.> can execshellcmd do it during compile time too? |
17:06:13 | FromDiscord | <.aingel.> If I'm running it in a static block |
17:06:16 | FromDiscord | <nervecenter> In a `static:` block it can |
17:06:27 | FromDiscord | <.aingel.> Right, so then whats the diff |
17:06:31 | FromDiscord | <.aingel.> Why do u need gorge |
17:06:32 | FromDiscord | <nervecenter> Much of the language can run in a `static:` block, very little can't |
17:06:55 | FromDiscord | <nervecenter> Uh...more explicit? I guess you'd need to ask someone who uses it |
17:07:22 | FromDiscord | <.aingel.> Gotcha |
17:07:43 | FromDiscord | <nervecenter> Also `const` defines compile-time constants, anything assigned to `const` will be evaluated at compile time |
17:07:58 | FromDiscord | <nervecenter> you can for example slurp the contents of a file at compile time and assign them to a `const` string |
17:08:08 | FromDiscord | <.aingel.> Right |
17:08:16 | FromDiscord | <.aingel.> Thats kinda cool actually |
17:08:18 | FromDiscord | <nervecenter> `const my_file = read_file("example.txt")` |
17:08:30 | FromDiscord | <.aingel.> Does cpp have that feature? |
17:08:43 | FromDiscord | <.aingel.> I'm sure it does somehow but doesn't seem that easy |
17:08:58 | FromDiscord | <nervecenter> I think it does but as far as I know, yeah it's pretty convoluted |
17:08:58 | FromDiscord | <.aingel.> Sounds like some preproc thing you'd have to do |
17:09:02 | FromDiscord | <.aingel.> Ya |
17:09:05 | FromDiscord | <.aingel.> Very cool |
17:09:18 | FromDiscord | <.aingel.> I like that nim has a lot of styles of writing code, it's more like ruby in that sense |
17:09:39 | FromDiscord | <nervecenter> I definitely recommend picking one for your own code and sticking to it, try not to mix |
17:09:39 | FromDiscord | <.aingel.> I wonder if it's more flexible in that regard than crystal |
17:10:28 | FromDiscord | <.aingel.> Yea I agre |
17:10:34 | FromDiscord | <.aingel.> I meant more like that you can pick your own style |
17:10:49 | FromDiscord | <.aingel.> Like, I prefer appending functino calls rather than prepending them like you have to do in python |
17:11:02 | FromDiscord | <.aingel.> I like how you have that option in nim |
17:11:13 | FromDiscord | <.aingel.> (edit) "functino" => "function" |
17:11:33 | FromDiscord | <nervecenter> sent a code paste, see https://play.nim-lang.org/#ix=4I4U |
17:11:39 | FromDiscord | <nervecenter> (edit) "https://play.nim-lang.org/#ix=4I4U" => "https://play.nim-lang.org/#ix=4I4V" |
17:12:08 | FromDiscord | <nervecenter> Working really well so far |
17:12:49 | FromDiscord | <nervecenter> And yes being able to chain procs with UFCS is quite nice |
17:13:23 | FromDiscord | <.aingel.> Oh cool, I thought the 4 spaces was against the nim standard formatting |
17:13:27 | FromDiscord | <nervecenter> You can design class-like modules that are just objects (structs) plus some procs that take the struct as the first `var` paramater |
17:13:29 | FromDiscord | <nervecenter> bam, a class |
17:13:31 | FromDiscord | <.aingel.> I find the 2 spaces kinda hard to read tbh |
17:13:52 | FromDiscord | <nervecenter> In reply to @.aingel. "Oh cool, I thought": You can do what you want really, just be clean and consistent |
17:14:10 | FromDiscord | <.aingel.> Gotcha |
17:14:11 | FromDiscord | <nervecenter> (edit) "struct" => "object" |
17:14:15 | FromDiscord | <.aingel.> Doesn't go have UFCS |
17:14:20 | FromDiscord | <.aingel.> (edit) "go" => "Go" |
17:14:21 | FromDiscord | <nervecenter> I dunno, D does |
17:16:23 | FromDiscord | <.aingel.> In reply to @nervecenter "bam, a class": Yeah this is nice |
17:16:33 | FromDiscord | <.aingel.> U don't really have to 'think' about oop |
17:18:05 | FromDiscord | <Phil> Just to make sure I'm not being an idiot:↵When I wrap a C enum it basically doesn't matter what name I give it all because in the end its all just ints, right? |
17:19:33 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4I4Y |
17:22:51 | FromDiscord | <stoneface86> that's what I do for wrapping C enums, I also use `{.size: sizeof(cint).}` as well |
17:23:42 | FromDiscord | <stoneface86> and if there's two members with the same value I make one of them a const |
17:30:46 | FromDiscord | <.aingel.> once I do nimble develop, do I need to do anything else for myself to be able to import that somewhere else? |
17:31:17 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "Basically you tell your": It happens with Confy (ZigCC) but not with default build system |
17:37:33 | FromDiscord | <Chronos [She/Her]> https://github.com/ee7/pragmagic-uuids/tree/urandom-CryptAcquireContext how would I use this lib as a nimble dep? |
17:41:29 | FromDiscord | <.aingel.> After I do nimble develop I still can't import the package |
17:41:37 | FromDiscord | <.aingel.> It works if i do nimble install though |
18:01:04 | FromDiscord | <.aingel.> What do I do with a header file I use importc with if I want to put that in a nimble package |
18:02:45 | FromDiscord | <.aingel.> When I import that nimble package it doesn't copy over the header files in the nimble package dir |
18:03:28 | FromDiscord | <mantielero> Hi all. I'd like to learn a little bit of OpenGL. I found [this](https://github.com/johnnovak/learnopengl-nim/tree/master), but seems outdated. Any recommendation? I also saw: nimgl, easygl, shady, ... Not sure about where to start. |
18:08:30 | FromDiscord | <Elegantbeef> I'd suggest using https://github.com/nim-lang/opengl and the learnopengl.com C++ code |
18:09:00 | FromDiscord | <Elegantbeef> It doesnt really matter where you go opengl is the same |
18:11:47 | FromDiscord | <vindaar> I agree with Elegantbeef.↵Just be aware of the difference between OpenGL 2 and modern OpenGL. Learn about the difference and then decide what it actually is you want to learn.Other resources\:↵● https://www.labri.fr/perso/nrougier/python-opengl/↵● https://www.opengl-tutorial.org/beginners-tutorials/ |
18:12:39 | FromDiscord | <mantielero> Thanks guys. I'll take a look. |
18:12:43 | FromDiscord | <.aingel.> @ElegantBeouf Do you know of a standard way to do importc with the header file for a nimble package? |
18:13:29 | FromDiscord | <.aingel.> I'm looking at the way it's done here, and was wondering if this is a standard or good way or if there's a simpler way https://github.com/wltsmrz/nim_zstd/blob/develop/zstd/common.nim |
18:17:06 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
18:22:24 | * | dza joined #nim |
18:33:04 | NimEventer | New thread by jmgomez: Pattern Matching , see https://forum.nim-lang.org/t/10526 |
18:33:15 | FromDiscord | <jmgomez> People, can you vote here if you want to see PM on the STD https://github.com/nim-lang/RFCs/issues/537 |
18:38:32 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4I5b |
18:45:38 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "u can do ;": yes, in fact its less errorprone, because you are forced to use a different type |
18:46:43 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "Is there a diff": yes, gorgeEx doesn't open a shell, it just eats the data and then gives it back to you↵execShellCmd outputs the data to the console, which is what I want but the vm has no support for shell execution |
18:47:04 | FromDiscord | <sOkam! 🫐> `when nimvm` does not support `exec` nor `execShellCmd` either |
18:47:18 | FromDiscord | <sOkam! 🫐> so you are forced to gorgeEx inside `static: ...` blocks |
18:47:37 | FromDiscord | <sOkam! 🫐> (edit) "blocks" => "blocks, even if the most desirable option is a shell" |
18:48:27 | FromDiscord | <sOkam! 🫐> In reply to @nervecenter "In a `static:` block": static does not allow non-vm commands |
18:50:04 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "once I do nimble": nimble develop is broken in a big way, been like that for months. so don't be suprised if it just doesn't do what you expect it to do |
18:56:02 | FromDiscord | <.aingel.> In reply to @heysokam "nimble develop is broken": Oh okay gotcha |
18:56:26 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I5g |
18:56:30 | FromDiscord | <.aingel.> @sOkam! 🫐 I'm having an issue getting the importc: header include to work in a nimble package |
18:56:49 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "<@186489007247589376> I'm having an": how are you resolving the lib path? |
18:56:54 | FromDiscord | <.aingel.> When I import something from nimble, it just copies over the nim file itself? |
18:57:11 | FromDiscord | <.aingel.> Well it builds normally if I'm just building it and not importing from nimble in another project |
18:57:20 | FromDiscord | <.aingel.> I'm just using the header file as local |
18:57:26 | FromDiscord | <.aingel.> like next to the nim file |
18:57:44 | FromDiscord | <sOkam! 🫐> whats your exact setup? there are a lot of moving pieces that I'm missing info about |
18:57:50 | FromDiscord | <sOkam! 🫐> (edit) "whats your exact setup? there are a lot of moving pieces ... that" added "there" |
18:58:34 | FromDiscord | <.aingel.> Right so, I have a package with nimble.. it's gemmaJSON/src/gemmaJSON.nim and some header file |
18:58:35 | FromDiscord | <.aingel.> {.importc: "cysimdjson_element_get_type", header: "gemmaJSON/cysimdjsonc.h".} |
18:58:40 | FromDiscord | <.aingel.> Importing it this way |
18:58:43 | FromDiscord | <sOkam! 🫐> also, are you configuring the nimble file so it adds `.h` files, not just `.nim`? just in case |
18:58:59 | FromDiscord | <.aingel.> In reply to @heysokam "also, are you configuring": No, how do I do that |
18:59:04 | FromDiscord | <.aingel.> Right now it's just copying the nim to the new proj cahce file |
18:59:06 | FromDiscord | <.aingel.> Which is the issue |
18:59:08 | FromDiscord | <sOkam! 🫐> i never remember the syntax, let me search |
18:59:17 | FromDiscord | <sOkam! 🫐> yeah then thats the probl probably |
18:59:56 | FromDiscord | <sOkam! 🫐> @.aingel. https://nim-lang.org/docs/nimscript.html#installFiles |
19:00:13 | FromDiscord | <sOkam! 🫐> sorry, this one https://nim-lang.org/docs/nimscript.html#installExt |
19:00:29 | FromDiscord | <sOkam! 🫐> `installExt = @[".nim", ".h"]` in your nimble file |
19:00:46 | FromDiscord | <.aingel.> Ah |
19:00:47 | FromDiscord | <sOkam! 🫐> if you have C files that you need, also remember to add that ext, or whatever else is required |
19:01:09 | FromDiscord | <.aingel.> So https://github.com/wltsmrz/nim_zstd/blob/develop/zstd/common.nim |
19:01:20 | FromDiscord | <.aingel.> This project also is a nimble package and it wraps a c lib |
19:01:26 | FromDiscord | <.aingel.> But I dont see it using installext or something |
19:01:28 | FromDiscord | <.aingel.> How does it work? |
19:02:12 | FromDiscord | <sOkam! 🫐> idk 🤷♂️ |
19:02:20 | FromDiscord | <sOkam! 🫐> but i always add them, and they work for me |
19:02:25 | FromDiscord | <.aingel.> gotcha |
19:03:29 | FromDiscord | <sOkam! 🫐> actually, you are right. i don't have them here either 🤔↵https://github.com/heysokam/nglfw/blob/master/nglfw.nimble↵maybe its because it is a submodule? 🧩 |
19:05:27 | * | rockcavera joined #nim |
19:05:49 | FromDiscord | <.aingel.> That breaks the nimble package too |
19:05:56 | FromDiscord | <.aingel.> It lets me install, but can't import it then |
19:06:01 | FromDiscord | <.aingel.> If I take out installExt = @[".nim", ".h"], then it works |
19:06:12 | FromDiscord | <.aingel.> Well lets me import, doesn't work cause fails on the header file |
19:06:28 | FromDiscord | <sOkam! 🫐> ic |
19:06:45 | FromDiscord | <.aingel.> I have the same structure as your proj there |
19:07:27 | FromDiscord | <.aingel.> Oh well nto eactly the same |
19:07:33 | FromDiscord | <.aingel.> cause yeah the procs are not in a submodule |
19:07:39 | FromDiscord | <.aingel.> Your main nim just has compile |
19:07:46 | FromDiscord | <.aingel.> And the procs are in the submodule |
19:07:50 | FromDiscord | <.aingel.> Idk if that changes anything |
19:08:26 | FromDiscord | <sOkam! 🫐> something is off, though. because this is not in a submodule and its added↵https://github.com/heysokam/nglfw/blob/master/src/nglfw/metal_glue.h |
19:08:35 | FromDiscord | <.aingel.> ` passC: &"-I{nglfwDir}", # Include nglfw/ for the metal_glue.h file` |
19:08:40 | FromDiscord | <.aingel.> I think this is it but |
19:08:50 | FromDiscord | <sOkam! 🫐> yeah but that's not for nimble |
19:09:02 | FromDiscord | <sOkam! 🫐> nimble doesn't know that line exists |
19:10:06 | FromDiscord | <.aingel.> When you import that package via nimble, the h files get copied over to the cache dir? |
19:10:15 | FromDiscord | <sOkam! 🫐> yeah afaik 🤔 |
19:10:24 | FromDiscord | <sOkam! 🫐> let me double check, just in case |
19:11:07 | FromDiscord | <sOkam! 🫐> yeah there they are https://media.discordapp.net/attachments/371759389889003532/1158843690115154001/image.png?ex=651db8c9&is=651c6749&hm=c9c7dc4bc90070a8a26093db48015ffa28122fd7d533ba31cb9b9781814998f2& |
19:11:16 | FromDiscord | <sOkam! 🫐> is your package a hybrid, maybe? |
19:11:22 | FromDiscord | <.aingel.> Nope |
19:11:38 | FromDiscord | <.aingel.> Wait |
19:11:46 | FromDiscord | <.aingel.> I'm not sure how to check but didnt select that |
19:11:52 | FromDiscord | <sOkam! 🫐> it would be a hybrid them moment is has `bin = ...` |
19:12:01 | FromDiscord | <sOkam! 🫐> (edit) "is" => "it" |
19:12:05 | FromDiscord | <.aingel.> Okay there's no nbin |
19:12:19 | FromDiscord | <.aingel.> sent a code paste, see https://play.nim-lang.org/#ix=4I5s |
19:12:27 | FromDiscord | <sOkam! 🫐> ah nah, thats a normal lib yea |
19:12:49 | FromDiscord | <sOkam! 🫐> confused why that's skipping the header, though. makes no sense. maybe someone else knows why, never happened to me so far |
19:12:55 | FromDiscord | <.aingel.> the .h files are ther ein the .nimble area |
19:13:08 | FromDiscord | <.aingel.> That's not the issue, I guess I don't really know how nimble imports things to a new project |
19:13:19 | FromDiscord | <.aingel.> But I have a new project like test.nim, and I do import myLibrary |
19:13:20 | FromDiscord | <sOkam! 🫐> can you sshot your project tree? |
19:13:25 | FromDiscord | <.aingel.> Which one |
19:13:53 | FromDiscord | <sOkam! 🫐> well the one that has the .h, but is skipping it when turning into a package |
19:14:02 | FromDiscord | <.aingel.> Nah that's not exactly what's happening |
19:14:07 | FromDiscord | <.aingel.> the .h goes into the nimble package |
19:14:17 | FromDiscord | <.aingel.> When I have a new proj, test, and I do import myNimblePack |
19:14:23 | FromDiscord | <.aingel.> I can see in the .test/cache |
19:14:30 | FromDiscord | <.aingel.> It pulls mynimblepack.nim |
19:14:37 | FromDiscord | <.aingel.> (edit) "mynimblepack.nim" => "mynimblepack.nim.c" |
19:14:50 | FromDiscord | <.aingel.> But no header files into the cache of my new test project |
19:14:51 | FromDiscord | <sOkam! 🫐> so the header is not copied over to the nimcache, but its inside the package? |
19:14:56 | FromDiscord | <.aingel.> Yeah |
19:15:03 | FromDiscord | <sOkam! 🫐> yeah thats not happening automatically |
19:15:26 | FromDiscord | <.aingel.> I'm not sure if ithe header is supposed to be copied to the cache |
19:15:31 | FromDiscord | <sOkam! 🫐> why do you think i have all those `thisDir` crap there 🙈↵you need to pass the paths absolute to the ocmpiler, so it doesn't choke |
19:16:09 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "I'm not sure if": its not, you just `-Ipath/to/header/` and then `header.h` in the import calls |
19:16:23 | FromDiscord | <.aingel.> okay but whats the path/to/header |
19:16:27 | FromDiscord | <.aingel.> the nimble path? |
19:16:45 | FromDiscord | <.aingel.> I guess that would maek sense lol |
19:16:50 | FromDiscord | <sOkam! 🫐> no, the absolute path where the header file is stored, but from the perspective of the compiler at compile time |
19:17:06 | FromDiscord | <.aingel.> Yeah, so the absolute path to the nimble installation |
19:17:12 | FromDiscord | <sOkam! 🫐> thats what that `-I{glfwDir}` is there fore |
19:17:18 | FromDiscord | <.aingel.> right |
19:18:03 | FromDiscord | <sOkam! 🫐> you need to take the path from the `thisDir` constant... and then feed it to the compiler with a `passC: "-Ithe/absolute/path/` |
19:19:17 | FromDiscord | <sOkam! 🫐> this turns into the correct absolute path at compiletime, from the perspective of the compiler↵https://github.com/heysokam/nglfw/blob/6484b0499d3e8c850baf6b7c287ead445b2e8a83/src/nglfw/compile.nim#L9↵That way you don't need to move the files, you just `-I{yourDir}` |
19:19:59 | FromDiscord | <.aingel.> gothc |
19:20:01 | FromDiscord | <.aingel.> (edit) "gothc" => "gotcha" |
19:25:29 | FromDiscord | <.aingel.> @sOkam! 🫐 how do I trigger the compile to run always |
19:25:35 | FromDiscord | <.aingel.> I feel it's not running if it's cached or something |
19:27:26 | FromDiscord | <.aingel.> It's okay actually |
19:28:29 | FromDiscord | <sOkam! 🫐> it runs whenever the files change, afaik |
19:29:03 | FromDiscord | <.aingel.> I got the header file to find but now just need to link the shared lib correctly |
19:38:39 | FromDiscord | <.aingel.> @sOkam! 🫐 so it's building the shared lib to the cache folder, but it's not linking |
19:38:51 | FromDiscord | <.aingel.> Even though I have `{.passL: &"-L{trgDir} -lgemmaJSON".}` in the compile.nim |
19:39:15 | FromDiscord | <.aingel.> sent a code paste, see https://play.nim-lang.org/#ix=4I5D |
19:40:17 | FromDiscord | <sOkam! 🫐> what does "not linking" mean exactly? |
19:40:42 | FromDiscord | <sOkam! 🫐> is it erroring on the file not being found? |
19:42:03 | FromDiscord | <.aingel.> sent a code paste, see https://paste.rs/LETYb |
19:42:07 | FromDiscord | <.aingel.> Yeah |
19:42:17 | FromDiscord | <.aingel.> ` nim c -r -f --passL:="-L/Users/saint/.cache/nim/test_d/" test.nim↵` |
19:42:25 | FromDiscord | <.aingel.> This is even after I explicitly do the passL again |
19:42:45 | FromDiscord | <.aingel.> sent a code paste, see https://paste.rs/kRLS0 |
19:42:52 | FromDiscord | <.aingel.> And the shared lib is there in the cache file |
19:42:53 | FromDiscord | <.aingel.> It gets built |
19:44:58 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "` nim c -r": is the `:=` a typo? |
19:51:12 | FromDiscord | <.aingel.> Ya sorry |
19:51:30 | FromDiscord | <.aingel.> No = |
19:52:08 | FromDiscord | <.aingel.> Yeah basically my issue is with the passL path now |
19:52:24 | FromDiscord | <.aingel.> Do you know how I can print during the compile stage? |
19:52:32 | FromDiscord | <.aingel.> my echos dont seem to show up anywher |
19:54:04 | FromDiscord | <.aingel.> Oh right it would only print on after running, which it isn't |
19:54:07 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "Do you know how": echo inside a static block will |
19:54:11 | FromDiscord | <.aingel.> Ah |
19:54:28 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I5G |
19:55:54 | FromDiscord | <.aingel.> Yup |
19:55:57 | FromDiscord | <.aingel.> Thanks! |
19:56:34 | FromDiscord | <.aingel.> Okay so...the shared lib builds in the cache dir, I am doing `{.passL: &"-L{trgDir}/ -lgemmaJSON".}` and trgDir is the cache dir, confirmed with a printout too |
19:57:47 | FromDiscord | <.aingel.> So it builds and links fine |
19:57:48 | FromDiscord | <.aingel.> But cannot run it |
19:57:54 | FromDiscord | <.aingel.> sent a long message, see http://ix.io/4I5I |
19:58:08 | FromDiscord | <.aingel.> (edit) "long message," => "code paste," | "http://ix.io/4I5I" => "https://play.nim-lang.org/#ix=4I5J" |
19:58:23 | FromDiscord | <sOkam! 🫐> ah because it wants access to it at runtime, maybe? |
19:58:28 | FromDiscord | <.aingel.> Yeah |
19:59:32 | FromDiscord | <sOkam! 🫐> seems to be searching for `./libgemmaJSON.so`, so you could help the user at compiletime by moving the .so file right next to the binary they output https://media.discordapp.net/attachments/371759389889003532/1158855879932772372/image.png?ex=651dc424&is=651c72a4&hm=5aac20ae0682fbbbb1eb8bd01dcdfddbde8a79b474d24f2fa11262f8e1568d20& |
19:59:46 | * | rez joined #nim |
19:59:54 | FromDiscord | <.aingel.> Yea |
20:00:16 | FromDiscord | <.aingel.> That makes sense, I guess it should be outputted next to the binary anyways for like |
20:00:19 | FromDiscord | <.aingel.> portability |
20:00:24 | FromDiscord | <.aingel.> Does that make sense? |
20:00:36 | FromDiscord | <sOkam! 🫐> probably, because they will need to distribute the file to the users too |
20:00:46 | FromDiscord | <sOkam! 🫐> so better to give it to them right away |
20:01:25 | FromDiscord | <.aingel.> Right |
20:06:32 | FromDiscord | <.aingel.> @sOkam! 🫐 Do you know how I get the current path of like where the compiler is going to output the binary? |
20:06:35 | FromDiscord | <.aingel.> Not the current source path |
20:06:37 | FromDiscord | <.aingel.> Or cache path |
20:08:44 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "<@186489007247589376> Do you know": maybe something in here https://nim-lang.org/docs/compilesettings.html |
20:09:39 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I5N |
20:10:13 | FromDiscord | <sOkam! 🫐> (edit) "https://play.nim-lang.org/#ix=4I5N" => "https://paste.rs/jEiYU" |
20:11:59 | FromDiscord | <.aingel.> Worked! Thanks a lot @sOkam! 🫐 |
20:12:05 | FromDiscord | <.aingel.> 🤗 |
20:15:27 | FromDiscord | <sOkam! 🫐> no worries. i feel like this sort of "buildsystem with compile pragmas and static blocks" should be a guide somewhere↵i struggled a lot to make it work too, just because I had no idea all these things existed |
20:15:55 | FromDiscord | <sOkam! 🫐> (edit) removed "feel like this sort of "buildsystem with compile pragmas and static blocks" should be a guide somewhere↵i" | "existed" => "existed↵i feel like this sort of "buildsystem with compile pragmas and static blocks" should be a guide somewhere" |
20:22:55 | FromDiscord | <.aingel.> Yeah definitely |
20:23:34 | * | rez quit (Quit: much snoozes...) |
20:54:23 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#ix=4I5R |
20:54:42 | FromDiscord | <user2m> (edit) "https://play.nim-lang.org/#ix=4I5R" => "https://play.nim-lang.org/#ix=4I5S" |
20:57:15 | FromDiscord | <user2m> ok I see here that parseJson closes the stream after it's done (https://nim-lang.org/docs/json.html#parseJson%2CStream%2Cstring) |
21:06:31 | FromDiscord | <.aingel.> In reply to @user2m "ok I see here": Yeah this is right I think |
21:06:50 | FromDiscord | <.aingel.> Also can someone tell me what the diff between static linking is an including a .o file to the compiler? |
21:11:58 | FromDiscord | <raynei486> In reply to @.aingel. "Also can someone tell": There isn't much difference other than the fact that a library is a collection of object files (inb4 "acktually") |
21:12:12 | FromDiscord | <.aingel.> Hmm |
21:12:28 | FromDiscord | <.aingel.> Why does macOS say it doesn't support staticly linked binaries then? |
21:12:32 | FromDiscord | <.aingel.> https://developer.apple.com/library/archive/qa/qa1118/_index.html |
21:12:38 | FromDiscord | <.aingel.> "A statically linked binary is one that does not import system libraries and frameworks dynamically, but instead makes direct system calls into the kernel." |
21:12:44 | FromDiscord | <.aingel.> I guess this means system libraries |
21:14:24 | FromDiscord | <raynei486> hmm |
21:15:20 | FromDiscord | <raynei486> I guess it's saying that it doesn't provide the C runtime for you to make statically linked binaries in macos |
21:15:27 | FromDiscord | <raynei486> since it specifically mentions `crt0.o` |
21:16:11 | FromDiscord | <raynei486> nvm |
21:16:15 | FromDiscord | <raynei486> that's exactly what the title is 💀 |
21:16:46 | FromDiscord | <.aingel.> Right |
21:16:58 | FromDiscord | <.aingel.> How do I include some .o files in the nim compiler? |
21:17:01 | FromDiscord | <.aingel.> is it passC? |
21:17:31 | FromDiscord | <raynei486> you just link it with `-l` |
21:18:32 | * | advesperacit quit () |
21:18:40 | FromDiscord | <raynei486> should be passing a flag to the linker |
21:18:53 | FromDiscord | <.aingel.> okay passL |
21:19:25 | * | oprypin quit (Quit: Bye) |
21:19:34 | * | oprypin joined #nim |
21:20:42 | FromDiscord | <.aingel.> Do you know how to do it @raynei486 |
21:20:48 | FromDiscord | <.aingel.> I think I've done it before but I've forgotten now |
21:21:49 | FromDiscord | <.aingel.> Oh, it's using the compile pragma I guess |
21:23:37 | FromDiscord | <.aingel.> (edit) "compile" => "link" |
21:24:10 | FromDiscord | <raynei486> Or you could do that |
21:27:42 | FromDiscord | <.aingel.> Soo you can compile c++ code and include it in C (for nim) |
21:28:06 | FromDiscord | <.aingel.> As longa s you have a a c header and do extern C, and you can dynamically link the C++ stl |
21:28:12 | FromDiscord | <.aingel.> Which is kinda wild I didn't know you could do that |
21:28:27 | FromDiscord | <.aingel.> I'm sure it's common knowledge but I didn't know, this would have saved me a lot of hassle |
21:31:22 | FromDiscord | <raynei486> pretty sure yes |
21:35:37 | FromDiscord | <raynei486> https://media.discordapp.net/attachments/371759389889003532/1158880058950299689/image.png?ex=651ddaa9&is=651c8929&hm=cdf729811dc06f5064ee2f0b668c4be81491486b5ee577d73515d5a8d5c31981& |
21:39:27 | FromDiscord | <.aingel.> What editor is that? |
21:39:49 | FromDiscord | <.aingel.> @raynei486 I think the main thing is using the c++ stl |
21:39:59 | FromDiscord | <.aingel.> I can link it with c using -lc++ on macos |
21:40:05 | FromDiscord | <.aingel.> Not sure what the lib name is for linux |
21:40:39 | FromDiscord | <.aingel.> Whats the command line equivalent of the link pragma? |
21:40:49 | FromDiscord | <raynei486> so you're trying to link the C++ stl on macos? |
21:41:28 | FromDiscord | <.aingel.> Ya |
21:41:33 | FromDiscord | <.aingel.> It works though @raynei486 |
21:41:49 | FromDiscord | <.aingel.> Everything is good, just wondering what the command line equiv of the link pragma is |
21:41:50 | FromDiscord | <raynei486> In reply to @.aingel. "What editor is that?": it's (black-box)[https://gitlab.gnome.org/raggesilver/blackbox] with solarized-dark theme |
21:41:59 | FromDiscord | <raynei486> yeah i'm also trying to figure it out |
21:42:05 | FromDiscord | <raynei486> nim docs are sometimes a bit scuffed |
21:42:10 | FromDiscord | <.aingel.> In reply to @raynei486 "nim docs are sometimes": Haha ya |
21:42:17 | FromDiscord | <.aingel.> In reply to @raynei486 "it's (black-box)[https://gitlab.gnome.org/raggesilv": What editor though? |
21:42:28 | FromDiscord | <.aingel.> Or is that just your compiler output? |
21:42:38 | FromDiscord | <raynei486> It's just a terminal emulator |
21:43:07 | FromDiscord | <.aingel.> No I got that |
21:43:31 | FromDiscord | <.aingel.> But it's printing out your source file too |
21:43:37 | FromDiscord | <.aingel.> Was that some sort of cat |
21:43:39 | FromDiscord | <raynei486> ohh |
21:44:05 | FromDiscord | <raynei486> yeah it's basically enhanced cat called [bat](https://github.com/sharkdp/bat) |
21:45:14 | FromDiscord | <.aingel.> Gotcha! |
21:49:43 | FromDiscord | <Chronos [She/Her]> Do y'all think it's worth making bindings to Rust libs in Nim? |
21:50:11 | FromDiscord | <Chronos [She/Her]> Out of pure curiosity here too, I don't have much knowledge of Rust besides the times I've touched it and went "nope" |
21:50:47 | FromDiscord | <.aingel.> We need to make rust less popular lol |
21:50:58 | NimEventer | New post on r/nim by angel__-__-: Command line equivalent of link pragma?, see https://reddit.com/r/nim/comments/16z4nf1/command_line_equivalent_of_link_pragma/ |
21:51:33 | FromDiscord | <Chronos [She/Her]> Wouldn't that just be `--passl:"-lLIBRARY"`? |
21:51:41 | FromDiscord | <raynei486> @.aingel. I got this working https://media.discordapp.net/attachments/371759389889003532/1158884099910553670/image.png?ex=651dde6c&is=651c8cec&hm=0c87bf31b0544f671d558cb2a4a99ebe7d42974ff55cf15533453d00b20d0459& |
21:51:45 | FromDiscord | <Chronos [She/Her]> Since `-l` on the C compiler is for linking? |
21:52:01 | FromDiscord | <Chronos [She/Her]> In reply to @.aingel. "We need to make": Yeah that's fair |
21:52:33 | FromDiscord | <Chronos [She/Her]> What if we made it so Rust's IR gets translated to Nim's IR /hj |
21:52:42 | FromDiscord | <Chronos [She/Her]> Or ig to Nim's AST |
21:53:16 | FromDiscord | <raynei486> good luck going through the rust compiler 💀 |
21:53:37 | FromDiscord | <Chronos [She/Her]> MIR |
21:55:01 | FromDiscord | <Chronos [She/Her]> https://github.com/rust-lang/miri there's an interpreter for it here, that's probably a start |
21:55:27 | FromDiscord | <raynei486> hmm |
21:55:37 | FromDiscord | <raynei486> I know Nim IR was announced but is there like any documents |
21:56:25 | FromDiscord | <Chronos [She/Her]> There's the RFC |
21:56:41 | FromDiscord | <Chronos [She/Her]> But also could just translate it to the AST |
21:58:01 | FromDiscord | <Chronos [She/Her]> https://github.com/nim-lang/Nim/pull/22777 |
21:58:38 | FromDiscord | <raynei486> thanks |
22:11:38 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
22:14:53 | * | Lord_Nightmare joined #nim |
22:18:52 | FromDiscord | <Chronos [She/Her]> Of course aha |
22:41:53 | * | tiorock joined #nim |
22:41:53 | * | tiorock quit (Changing host) |
22:41:53 | * | tiorock joined #nim |
22:41:53 | * | rockcavera is now known as Guest9932 |
22:41:53 | * | Guest9932 quit (Killed (copper.libera.chat (Nickname regained by services))) |
22:41:53 | * | tiorock is now known as rockcavera |
22:56:55 | * | azimut quit (Ping timeout: 252 seconds) |
23:12:22 | FromDiscord | <.aingel.> Awesome! thanks |
23:13:23 | FromDiscord | <.aingel.> In reply to @raynei486 "<@1152336447467163790> I got this": Awesome, thanks! It works |
23:16:51 | FromDiscord | <.aingel.> seems like passL and link are the same then |
23:21:50 | * | alphacentauri quit (Quit: WeeChat 4.0.5) |
23:22:20 | FromDiscord | <_gumbercules> They're not - `link` allows you to specify a library or object file to be linked while `passL` passes arguments to the linker |
23:22:45 | FromDiscord | <_gumbercules> but I don't believe you can pass linker arguments to `link` - only paths to library files / object files |
23:23:28 | FromDiscord | <_gumbercules> I could also be wrong but I don't ever recall seeing `link` being used for such a purpose nor have I ever used it for such |
23:24:12 | * | alphacentauri joined #nim |
23:25:02 | FromDiscord | <.aingel.> In reply to @_gumbercules "I could also be": Right you seem to be right |
23:25:13 | FromDiscord | <.aingel.> Or rather passL can do what link does, link is more restrictive |
23:52:41 | * | krux02 quit (Remote host closed the connection) |