00:05:52 | * | Mister_Magister quit (Quit: bye) |
00:06:13 | FromDiscord | <patitotective> im kind of confused with nim 2.0.0↵i did nimble install on my local library and it installed it on a pkgs2 folder instead of the pkgs folder↵but when i compile with nim 2.0.0 it still uses the pkgs folder version of the library instead of the pkgs2, am i missing something? |
00:07:05 | FromDiscord | <patitotective> (edit) "library" => "package" |
00:07:18 | FromDiscord | <Elegantbeef> Nimble 0.14 is funny |
00:07:18 | FromDiscord | <Elegantbeef> It uses pkgs and pkgs2 |
00:07:33 | FromDiscord | <patitotective> so should i update my nimble? |
00:07:42 | FromDiscord | <Elegantbeef> No you should cry |
00:07:47 | * | Mister_Magister joined #nim |
00:08:11 | FromDiscord | <patitotective> thats not very reassuring |
00:08:33 | FromDiscord | <Elegantbeef> You need to remove the `pkgs` inside your nim config file |
00:08:36 | FromDiscord | <Phil> In reply to @patitotective "im kind of confused": My recommendation:↵Make a nimbledeps folder so it uses project local dependencies |
00:09:14 | FromDiscord | <Phil> literally just make the folder, nimble scans for that, notice its there and install the required dependencies defined in your nimble file |
00:09:42 | FromDiscord | <Phil> (edit) "install" => "installs" | "installsthe required dependencies defined in your nimble file ... " added "into there" |
00:10:12 | FromDiscord | <Phil> Doing that and using --path is the thing I've started doing more and found it pretty nice |
00:35:57 | * | rockcavera quit (Remote host closed the connection) |
00:47:26 | * | rockcavera joined #nim |
00:59:35 | * | krux02 quit (Remote host closed the connection) |
01:07:57 | FromDiscord | <__nycto__> Question:↵if I’ve got two memory pools that I’m representing as UncheckedArrays, what’s the idiomatic way to move a value between them without calling =copy? Should I just manually call =sink? |
01:08:22 | FromDiscord | <__nycto__> (edit) "I’m representing" => "are implemented" |
01:08:57 | FromDiscord | <Elegantbeef> `a[ind] = b[ind]` |
01:09:25 | FromDiscord | <Elegantbeef> If you want to certainly move you can do `a[ind] = ensureMove b[ind]` |
01:10:18 | FromDiscord | <__nycto__> Awesome I’ll give that a try. The first mechanism was calling =copy for me |
01:10:43 | FromDiscord | <Elegantbeef> Well Nim copies when a sink cannot be made |
01:12:02 | FromDiscord | <__nycto__> Yup — this is a situation where I have more context than the compiler. |
01:15:18 | FromDiscord | <my.narco> how to can i write a whole ``seq[uint64]`` to a file? |
01:15:37 | FromDiscord | <Elegantbeef> `writeData` in syncio i believe |
01:15:51 | FromDiscord | <my.narco> it asks for a pointer |
01:15:56 | FromDiscord | <my.narco> how can i convert a seq to ptr? |
01:16:13 | FromDiscord | <Elegantbeef> `mySeq[0].addr` |
01:16:38 | FromDiscord | <my.narco> https://media.discordapp.net/attachments/371759389889003532/1158210901120385224/image.png?ex=651b6b75&is=651a19f5&hm=7ebf5cd6abd42ed1f55fd081cef5bed71790500646ca8e5e4e1596357fc660ef& |
01:16:46 | FromDiscord | <my.narco> it expects a pointer |
01:16:51 | FromDiscord | <my.narco> like the type ``pointer`` |
01:16:58 | FromDiscord | <Elegantbeef> `pointer` is implicitly converted to |
01:17:06 | FromDiscord | <sOkam! 🫐> In reply to @my.narco "like the type ``pointer``": `ptr T is pointer == true` |
01:17:29 | FromDiscord | <my.narco> sent a code paste, see https://play.nim-lang.org/#ix=4HX6 |
01:17:37 | FromDiscord | <Elegantbeef> The issue is you didnt supply how much to write |
01:17:38 | FromDiscord | <Elegantbeef> `sizeof(uint64) mySeq.len` |
01:17:48 | FromDiscord | <my.narco> i gotta stop probramming when its late |
01:21:29 | FromDiscord | <Elegantbeef> Remember that'll print the binary data, so if you do not want that you need to do something else |
02:16:32 | FromDiscord | <diogenesoftoronto> my cli-app works for the happy path right now there are some improvements to be add but this is not a bad state for this tool right now. I have some bugs to fix and tests to write and a few documentation / ux comforts but it is mostly how i want it to work which is awesome! https://media.discordapp.net/attachments/371759389889003532/1158225978615676998/image.png?ex=651b7980&is=651a2800&hm=6b2f08eabff9771ebc2de8bc5cd79c641eae9b98 |
02:16:52 | FromDiscord | <diogenesoftoronto> cligen is pretty nice man |
02:20:19 | FromDiscord | <diogenesoftoronto> its nice to be back to writing nim after so long |
02:37:27 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://paste.rs/iNpcr |
03:10:29 | FromDiscord | <odexine> not sure if asan tracks the nim allocator |
03:10:36 | FromDiscord | <odexine> rather lsan |
03:13:45 | FromDiscord | <Elegantbeef> Tooling does not know the Nim allocator, you need to use `-d:useMalloc` |
04:16:03 | FromDiscord | <sOkam! 🫐> ? |
04:16:29 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4HXA |
04:20:33 | FromDiscord | <odexine> `-d` or `--define` not `--d`? |
04:20:42 | FromDiscord | <odexine> i'm surprised that doesnt complain |
04:34:36 | FromDiscord | <Elegantbeef> Using orc @sOkam! 🫐 ? |
04:57:03 | FromDiscord | <sOkam! 🫐> yeah, why |
04:58:49 | FromDiscord | <sOkam! 🫐> the sanitizer is complaining because I have a bunch of objects that I allocate with wgpu and never release because im nub 🤷♂️ and i have a massive 2GB ram leak per frame. so yeah, its not nim thats the issue |
04:58:57 | FromDiscord | <Elegantbeef> Cause `useMalloc` only works for Orc/ARc |
04:59:06 | FromDiscord | <Elegantbeef> Time to use destructors |
04:59:28 | FromDiscord | <sOkam! 🫐> how would that work for C objects? |
05:00:34 | FromDiscord | <Elegantbeef> you make a `=destroy` that calls the deallocation object |
05:00:38 | FromDiscord | <Elegantbeef> deallocation proc |
05:00:58 | FromDiscord | <sOkam! 🫐> i understand, but how would that work in practice? what am i supposed to do with it |
05:01:07 | FromDiscord | <Elegantbeef> Orc/arc handles it |
05:01:11 | FromDiscord | <Elegantbeef> I'm uncertain what you mean |
05:01:27 | FromDiscord | <sOkam! 🫐> i heard that you need to X or Y or else hooks don't work |
05:01:56 | FromDiscord | <Elegantbeef> You define a hook for your type, it works |
05:02:06 | FromDiscord | <sOkam! 🫐> i don't remember what it was, but i remember something being specifically about them needs to be setup in a certain way or else they don't work |
05:02:09 | FromDiscord | <Elegantbeef> You do not need to do anything to have a hook invoke other than declare it |
05:02:21 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimscripter/blob/dll/src/nimscripter/nimscr.nim#L82-L94 |
05:02:46 | FromDiscord | <sOkam! 🫐> then why were you saying here in this chat to somebody that "you need to X/Y or else they are not recognized or not work" (paraprhasing) |
05:02:47 | FromDiscord | <Elegantbeef> An example of hooks using FFI |
05:02:55 | FromDiscord | <Elegantbeef> I never said that |
05:03:03 | FromDiscord | <Elegantbeef> Hooks only work on `object` or `distinct` types |
05:03:05 | FromDiscord | <Elegantbeef> That's it |
05:03:10 | FromDiscord | <sOkam! 🫐> i don't know what said or in which context |
05:03:15 | FromDiscord | <sOkam! 🫐> but i remember something |
05:03:49 | FromDiscord | <sOkam! 🫐> In reply to @Elegantbeef "Hooks only work on": so you randomnly declare them in whatever file you want? |
05:04:05 | FromDiscord | <sOkam! 🫐> they don't need to happen before anything? |
05:06:03 | FromDiscord | <sOkam! 🫐> i vividly remember someone saying that their hooks were not being run, and someone answering that they needed to do [insert thing] so that they are recognized before being run, otherwise nim reads the default hooks |
05:06:39 | FromDiscord | <arathanis> there are a certain set of hooks that rely on each other and if you don't specify your intention to declare your own ahead of time you will still get an autogenerated one |
05:06:59 | FromDiscord | <sOkam! 🫐> how do you declare it ahead of time? |
05:07:26 | FromDiscord | <Elegantbeef> They need to be declared in the module with the type |
05:07:39 | FromDiscord | <Elegantbeef> And be declared before the type is used |
05:07:57 | FromDiscord | <sOkam! 🫐> i see. so there is something specific about them, see |
05:08:02 | FromDiscord | <Elegantbeef> If a type is used before a hook is declared your hook is obviously not used |
05:08:04 | FromDiscord | <sOkam! 🫐> kk ty ✍️ |
05:08:15 | FromDiscord | <sOkam! 🫐> because im the type of person to 1000% crash on that |
05:08:48 | FromDiscord | <arathanis> you basically have to provide a forward declaration which i think is just a bodyless proc def |
05:08:49 | FromDiscord | <arathanis> https://nim-lang.org/docs/destructors.html#lifetimeminustracking-hooks-nimeqtrace-hook |
05:09:04 | FromDiscord | <arathanis> this is the section that talks about it, its for `=destroy` and `=trace` |
05:09:22 | FromDiscord | <Elegantbeef> My nimscripter example does show how to forward declare them and everything |
05:10:04 | FromDiscord | <sOkam! 🫐> in my experiences so far, forward declarations cannot be in a different file than their definition (or at least I haven't found a way to do that) so kinda the same for this specific situation |
05:10:50 | FromDiscord | <sOkam! 🫐> will try to do that tomorrow, im giga brainded right now ✍️ |
05:11:00 | FromDiscord | <Elegantbeef> I mean of course they cannot be in a seperate file |
05:11:05 | FromDiscord | <Elegantbeef> Nim is a module based language |
05:11:26 | FromDiscord | <Elegantbeef> If you forward declare a proc in module a unless you implement it in module a it'll be a different proc |
05:11:39 | FromDiscord | <Elegantbeef> You can use `include` to get around that, but don't use include |
05:13:52 | FromDiscord | <sOkam! 🫐> oh i think i know where the leak is from. happened last time without the abstraction↵it must be the texture view/data not being freed each frame |
05:41:11 | * | advesperacit joined #nim |
05:48:09 | * | azimut quit (Ping timeout: 252 seconds) |
05:54:27 | * | rockcavera quit (Remote host closed the connection) |
06:08:01 | * | junaid_ joined #nim |
06:44:13 | * | PMunch joined #nim |
07:07:32 | * | advesperacit quit (Ping timeout: 272 seconds) |
07:07:39 | * | advesperacit_ joined #nim |
08:20:29 | * | advesperacit_ quit (Ping timeout: 258 seconds) |
08:20:48 | * | advesperacit joined #nim |
08:32:25 | * | blop_ quit (Ping timeout: 252 seconds) |
08:33:35 | * | blop_ joined #nim |
08:35:54 | * | PMunch_ joined #nim |
08:38:43 | * | PMunch quit (Ping timeout: 264 seconds) |
08:44:53 | * | PMunch_ is now known as PMunch |
09:09:07 | * | junaid_ quit (Remote host closed the connection) |
10:03:49 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#ix=4HYr |
10:08:56 | FromDiscord | <vindaar> the issue is your explicit usage of `{` and `}` at the beginning/end of the string mess it up |
10:09:23 | FromDiscord | <aintea> so I need to `\{` ? |
10:09:52 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/strformat.html |
10:10:35 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/strformat.html#fmt.t%2Cstaticstring%2Cstaticchar%2Cstaticchar |
10:11:00 | FromDiscord | <demotomohiro> You can set custom `openChar`, `closeChar` |
10:11:44 | FromDiscord | <demotomohiro> > Parts of the string that are enclosed in the curly braces are interpreted as Nim code. To escape a { or }, double it. |
10:12:45 | FromDiscord | <aintea> thanks |
10:28:59 | * | junaid_ joined #nim |
11:10:01 | * | def- quit (Quit: -) |
11:10:18 | * | def- joined #nim |
11:15:08 | * | def- quit (Client Quit) |
11:15:21 | * | def- joined #nim |
11:39:17 | FromDiscord | <jviega> In reply to @heysokam "in my experiences so": You can do it without having to use `include`. In the file you need the prototype, do `proc foo() {.importc.}` And then for the actual declaration in the other file, make sure you're going to get a compatable declaration with `{.exportc, cdecl.}` |
12:19:04 | * | rez joined #nim |
12:19:25 | * | rez quit (Client Quit) |
13:09:36 | * | PMunch quit (Quit: Leaving) |
13:40:52 | * | rez joined #nim |
13:44:53 | * | rez quit (Client Quit) |
13:44:57 | FromDiscord | <sOkam! 🫐> In reply to @jviega "You can do it": neat trick |
13:45:19 | * | cnx quit (Ping timeout: 264 seconds) |
13:49:27 | FromDiscord | <jviega> Thanks, it only took me like 8 months to come up w/ it 😦 |
13:53:48 | * | cnx joined #nim |
14:02:32 | * | rockcavera joined #nim |
14:07:35 | * | junaid_ quit (Remote host closed the connection) |
14:11:44 | NimEventer | New Nimble package! sigui - Easy to use and flexible UI framework in pure Nim, see https://github.com/levovix0/sigui |
14:40:59 | FromDiscord | <sOkam! 🫐> @levovix https://github.com/DanielBelmes/vulkan btw |
14:41:08 | FromDiscord | <sOkam! 🫐> nimgl/vulkan is beyond outdated |
14:58:11 | FromDiscord | <levovix> thanks, didn't know about this package |
15:07:31 | * | Guest23 joined #nim |
15:08:12 | * | Guest44 joined #nim |
15:08:28 | * | Guest23 quit (Client Quit) |
15:17:48 | * | junaid_ joined #nim |
15:22:58 | * | Guest44 quit (Quit: Client closed) |
15:32:12 | * | azimut joined #nim |
15:34:49 | NimEventer | New thread by ingo: System.string, see https://forum.nim-lang.org/t/10524 |
15:54:25 | FromDiscord | <_gumbercules> One day someone will build a UI framework that is actually a UI framework and not an application framework |
15:54:49 | FromDiscord | <_gumbercules> With Nim I mean |
15:58:55 | * | junaid_ quit (Remote host closed the connection) |
16:13:08 | FromDiscord | <Chronos [She/Her]> Do y'all think Netty (the Nim library) would be compatible with the Raknet standard that MC Bedrock edition uses? |
16:13:14 | FromDiscord | <Chronos [She/Her]> Since Netty also uses Raknet, right? |
16:14:10 | FromDiscord | <Chronos [She/Her]> All I'd need to do is make sure the packet data is correct for communication |
16:15:21 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4HZv |
16:16:05 | FromDiscord | <sOkam! 🫐> (edit) "https://play.nim-lang.org/#ix=4HZv" => "https://play.nim-lang.org/#ix=4HZw" |
16:16:14 | * | def- quit (Quit: -) |
16:16:50 | * | def- joined #nim |
16:17:04 | FromDiscord | <jviega> If it's alloc'd normally, then yes the assignment will decref the old data |
16:17:05 | FromDiscord | <Elegantbeef> Orc only manages objects with destructors so if your type isnt a `ref` or doesnt have a destructor it doesnt manage it |
16:17:33 | FromDiscord | <sOkam! 🫐> kk, didin't know the assignment is what dereferences ✍️ |
16:17:44 | FromDiscord | <sOkam! 🫐> what would happen in the stack case? how is that managed? |
16:18:01 | FromDiscord | <Elegantbeef> It calls the destructor |
16:18:29 | FromDiscord | <Elegantbeef> It's not that assignment decrements the counter as much as calling the ref destructor decrements the counter |
16:18:46 | FromDiscord | <Elegantbeef> Cause it no longer is referenced |
16:18:54 | FromDiscord | <jviega> In a non-refcounting approach btw, it gets cleaned up when the collector notices that no "root" memory cells (global variables, stuff on your stack, etc) point to it anymore. |
16:19:25 | FromDiscord | <sOkam! 🫐> there is a default stack collector? |
16:19:31 | FromDiscord | <sOkam! 🫐> even in C? |
16:19:35 | FromDiscord | <sOkam! 🫐> or did you mean something else |
16:19:50 | FromDiscord | <Elegantbeef> There is no stack collector |
16:20:20 | FromDiscord | <Elegantbeef> The stack grows and shrinks at the end of the current stack frame |
16:20:45 | FromDiscord | <sOkam! 🫐> > In a non-refcounting approach ... it gets cleaned up when the collector....↵That's why i asked about a collector. If we are talking non-rc.... then what's the collector there from? |
16:21:26 | FromDiscord | <Elegantbeef> The garbage collector inside refc for ref types |
16:21:30 | FromDiscord | <Elegantbeef> for instance |
16:21:50 | FromDiscord | <sOkam! 🫐> kk |
16:22:01 | FromDiscord | <Elegantbeef> You're talking about garbage collection so of course we're not really talking about stack data |
16:22:26 | FromDiscord | <sOkam! 🫐> In reply to @Elegantbeef "The stack grows and": how is the stack data managed on reasignment then? assuming --mm:none or C for a moment |
16:22:44 | FromDiscord | <Elegantbeef> Nothing happens |
16:22:47 | FromDiscord | <Elegantbeef> you move data from b onto a |
16:23:10 | FromDiscord | <sOkam! 🫐> but what about the previous? is it just overwritten and thats it? |
16:23:20 | FromDiscord | <Elegantbeef> The stack doesnt need any management |
16:23:25 | FromDiscord | <Elegantbeef> Everytime you call a function the stack grows and every time you exit it shrinks |
16:23:38 | FromDiscord | <Elegantbeef> Yes the stack does not need any management due to how it works |
16:23:39 | FromDiscord | <sOkam! 🫐> yeah but my question is about the why, i believe |
16:23:58 | FromDiscord | <sOkam! 🫐> if the data is just overwritten, then that would explain it. im just asking if that's the case |
16:24:46 | FromDiscord | <Elegantbeef> The stack is a simple fixed size memory allocation that you write to as you go down there is generally no clearing which is why in C the idiom of `MyStruct val = {}` exists |
16:25:06 | FromDiscord | <sOkam! 🫐> kk |
16:25:09 | FromDiscord | <Elegantbeef> This is also why many modern languages implicitly clear to 0 |
16:25:19 | FromDiscord | <Elegantbeef> It's not memory safe to do `MyStruct val;` |
16:25:32 | FromDiscord | <Elegantbeef> Since if `MyStruct` has a pointer in it and you dereference it you get random memory |
16:25:50 | FromDiscord | <sOkam! 🫐> yeah ik |
16:26:49 | FromDiscord | <sOkam! 🫐> In reply to @Elegantbeef "The stack is a": the "going down" of this is confusing though↵is the data overwritten or are new stack allocations done instead? |
16:27:38 | FromDiscord | <sOkam! 🫐> (edit) "In reply to @Elegantbeef "The stack is a": the "going down" of this is confusing though↵is the ... data" added "stack" |
16:28:21 | FromDiscord | <Elegantbeef> A procedure grows the stack to what it needs when it's called there is no dynamic stack allocations unless you use alloca |
16:28:21 | FromDiscord | <Elegantbeef> Never use alloca |
16:29:07 | FromDiscord | <sOkam! 🫐> you are asking a bigger question that i don't quite understand the depth of.... my question is much simpler |
16:29:26 | FromDiscord | <sOkam! 🫐> is the data overwritten or not? what happens to the old data, in the most stupidest-simplest way to see it? |
16:29:37 | FromDiscord | <Elegantbeef> Nothing happens to the old data |
16:29:43 | FromDiscord | <sOkam! 🫐> (edit) "asking" => "answering" |
16:29:56 | FromDiscord | <sOkam! 🫐> -answering- _typo_ |
16:30:20 | FromDiscord | <Elegantbeef> That's how the stack works, you write to it, there is no clearing |
16:30:29 | FromDiscord | <sOkam! 🫐> then its overwritten? |
16:30:54 | FromDiscord | <Elegantbeef> Later on when you go to another stackframe that occupies the same space |
16:31:00 | FromDiscord | <sOkam! 🫐> if i have a box of 8 switches, do i flip the switches into new states, or do i ignore this box forever and use another one? |
16:31:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4HZB |
16:31:42 | FromDiscord | <jviega> Stacks are stacks in every programming language ever. You push and pop stuff on the stack, and if you pop a call frame and push a new one one, the same memory gets reused |
16:31:46 | FromDiscord | <Elegantbeef> You need to understand there is nothing magical about the stack |
16:32:10 | FromDiscord | <sOkam! 🫐> im not asking about those huge questions you are answering, guys |
16:32:16 | FromDiscord | <jviega> Like Beef said, 99.9% of languages (the ones where there are letters other than C in the name) will zero out the memory of anything pushed |
16:32:17 | FromDiscord | <Elegantbeef> It's a simple memory allocation principle |
16:32:29 | FromDiscord | <Elegantbeef> There is another box |
16:32:39 | FromDiscord | <Elegantbeef> You never need to worry about where the memory is going on the stack |
16:32:48 | FromDiscord | <Elegantbeef> Your memory is only valid until the end of the stack frame |
16:32:49 | FromDiscord | <jviega> Not sure I understand what you don't understand and want to know then 🙂 |
16:32:50 | FromDiscord | <sOkam! 🫐> i know i don't need to worry, im just wondering |
16:33:23 | FromDiscord | <Elegantbeef> I don't get what you're asking |
16:34:27 | FromDiscord | <Elegantbeef> In the above example calling `doThing` grows the stack by `sizeof(int)` you write `0` to that, then call `echo` which grows the stack frame further. echo exits popping the stack frame smaller, then you exit `doThing` popping it back to the original size, rinse and repeat for `doOtherThing` |
16:35:00 | FromDiscord | <Elegantbeef> If this doesnt help your question I don't know what to say |
16:40:33 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4HZG |
16:41:11 | FromDiscord | <sOkam! 🫐> there is a big difference between using new space and forgetting about the old... than writing to that exact same space |
16:41:38 | FromDiscord | <Elegantbeef> `otherThing` uses other memory, `thing` copies the memory from `otherThing` |
16:41:46 | FromDiscord | <Elegantbeef> `thing` cannot move in memory |
16:42:01 | FromDiscord | <Elegantbeef> It's not a pointer variable it's a variable stuck in the stack |
16:42:21 | FromDiscord | <jviega> That's unclear and not a question. Anything on the stack, whether it copies it or not, will go away when your function returns. If you copied it, you may have that copy somewhere else, be it on the heap or farther up the stack |
16:42:22 | FromDiscord | <sOkam! 🫐> In reply to @Elegantbeef "`otherThing` uses other memory,": omg beef, please simplify it. im not writting `otherthing` representing a separate variable. its pseudocdoe |
16:42:36 | FromDiscord | <jviega> But the local variable and its contents are not directly available to you |
16:42:58 | * | junaid_ joined #nim |
16:43:04 | FromDiscord | <Elegantbeef> I mean it doesnt matter if `otherThing` is an expression, a variable or a procedure call |
16:43:23 | FromDiscord | <sOkam! 🫐> imagine its just data |
16:43:31 | termer | Cool pic I'm sharing with you guys: |
16:43:33 | termer | https://static.termer.net/download/tycffypc4n/invisible_bike_still_frame_photo_of_cat_jumping_without_watermark.jpg |
16:43:33 | FromDiscord | <sOkam! 🫐> no expression, variable, prodecure call. just data |
16:44:04 | FromDiscord | <Elegantbeef> It's a variable assignment, so i already did imagine it as data |
16:44:32 | FromDiscord | <sOkam! 🫐> then i understand even less |
16:44:33 | FromDiscord | <Elegantbeef> You copy from other thing and that's all there is to it |
16:44:55 | FromDiscord | <Elegantbeef> `thing` is just a index inside of a `array[StackSize, byte]` |
16:45:01 | FromDiscord | <sOkam! 🫐> its fine, its not the end of the world. i can live without understanding this one. ty for trying to explain it ✍️ |
16:45:22 | FromDiscord | <Elegantbeef> There isnt much special about what's going on |
16:46:05 | FromDiscord | <Elegantbeef> You assign a variable that assignes `stack[thing]`'s data to the data on the right of `=` |
16:46:08 | FromDiscord | <jviega> This is a very important concept esp if you're doing C interfacing, sOkam |
16:46:25 | FromDiscord | <Elegantbeef> Assignment is just `copyMem(addr a, addr b, sizeof(a))` |
16:46:51 | FromDiscord | <Elegantbeef> At-least conceptually |
16:46:51 | * | junaid_ quit (Remote host closed the connection) |
16:47:01 | FromDiscord | <jviega> The best way to learn it tho is to deal with corrupted stacks perhaps 🙂 |
16:47:23 | FromDiscord | <Elegantbeef> What a cruel thing to impart on someone |
16:47:46 | FromDiscord | <Elegantbeef> "My pointers are randomly changing their values only when I call X function" |
16:48:32 | FromDiscord | <jviega> Oh yeah, nothing like C heisenbugs. If they're not this kind of issue, then it's some other issue likely to have deep security implications 🙂 |
16:48:57 | FromDiscord | <Elegantbeef> Hey buffer overflow is not a security bug, it's an exploit feature! |
16:49:51 | FromDiscord | <jviega> I think people would be shocked if they new how often one byte HEAP overflows are actually exploitable. |
16:51:25 | FromDiscord | <Elegantbeef> Pascal\: "Wait you're using nil terminated buffers?!" |
16:52:29 | FromDiscord | <diogenesoftoronto> Are fixed buffers really fixed? |
16:53:14 | FromDiscord | <Elegantbeef> It's in the name they're totally fixed! |
16:53:15 | FromDiscord | <Elegantbeef> You ever make a commit message like "Fixed X for realsies this time"? |
16:53:18 | FromDiscord | <jviega> That's not a specific enough question, but generally I'd expect it's there in the name |
16:55:13 | FromDiscord | <diogenesoftoronto> If you try accessing memory beyond what a fixed buffer gives you your program panics but how do panics actually work? Is it just like quit(1) or something |
16:55:34 | FromDiscord | <Elegantbeef> In Nim it's a range defect and it closes the program |
16:55:37 | FromDiscord | <Elegantbeef> Well index defect |
16:56:18 | FromDiscord | <Elegantbeef> Now if you compile without `--panics:on` you technically can catch the defect, but please don't thanks |
16:56:19 | FromDiscord | <jviega> No, that's language and hardware dependent, but generally if you're not in an environment w/ automated bounds checking, the "fixed" buffer isn't a concept under the hood and your write keeps going |
16:56:44 | FromDiscord | <Elegantbeef> C's `T a[10]` enters the chat |
16:56:52 | FromDiscord | <jviega> Now if you read or write onto a page that doesn't exist, the hardware will usually page fault |
16:56:59 | FromDiscord | <jviega> And deliver SIGSEGV |
16:57:16 | FromDiscord | <diogenesoftoronto> Usually |
16:57:22 | FromDiscord | <diogenesoftoronto> :MeguDed: |
16:57:36 | FromDiscord | <Elegantbeef> Implementation defined |
16:58:09 | FromDiscord | <jviega> There are all sorts of other conditions too. But a lot of the ways things fail can be due to how what you overwrote is used |
17:45:46 | FromDiscord | <my.narco> hooray! https://media.discordapp.net/attachments/371759389889003532/1158459823176831016/image.png?ex=651c5348&is=651b01c8&hm=da596c63f1b34dbc6e037ff2242bce5f3e70e5cf4291a6275e14caa03a0d1a69& |
17:58:25 | FromDiscord | <diogenesoftoronto> Too much anime |
18:03:23 | FromDiscord | <Chronos [She/Her]> No such thing as too much anime 😎 |
18:14:52 | FromDiscord | <michaelb.eth> https://media.discordapp.net/attachments/371759389889003532/1158467145588555867/image.png?ex=651c5a1a&is=651b089a&hm=0edf0d9a37d5fc18bf737563995734d05e1a955fa9943a2fe8865bd992b7e1af& |
18:16:19 | FromDiscord | <michaelb.eth> whoops, just realized this is main, not offtopic, oh well |
18:44:30 | om3ga | Hello! Is it possible to mute dlopen warnings for specific shared lib? db_connector/db_mysql tries to load libmysqlclient, then libmariadbclient which I use. |
18:46:35 | FromDiscord | <varriount> @juancarlospaco How much effort would it take to set up a GitHub action to run reformatters over PRs (for files like JSON and Markdown) and suggest changes? |
18:47:06 | FromDiscord | <varriount> In reply to @om3ga "Hello! Is it possible": What warnings are you getting? |
18:47:35 | om3ga | varriount: dlopen(libmysqlclient.dylib, 2): image not found |
18:51:01 | FromDiscord | <varriount> Odd, it's using the standard Nim dynlib mechanism, and as far as I know, that doesn't normally emit those messages. What command line are you using to compile things? |
18:52:00 | emery | om3ga: you could link to the libary at compile time like the grownup languages do |
18:52:48 | FromDiscord | <michaelb.eth> In reply to @emery "om3ga: you could link": in that case would need to pair with `--dynlibOverride:...` passed to Nim compiler |
18:52:51 | om3ga | varriount: --d:nimDebugDlOpen to have info if dynlib failed to load, but since I have mariadbclient, mysqlclient warnings are false positive |
18:53:15 | om3ga | michaelb.eth: oh! thanks a lot! I will try |
18:54:16 | FromDiscord | <michaelb.eth> ah yeah, if you're happy with dlopen for mariadbclient then maybe `--dynlibOverride:mysqlclient` will be enough |
18:56:04 | om3ga | great, thank you! |
18:56:57 | FromDiscord | <juancarlospaco> In reply to @varriount "<@265644131521527808> How much effort": What do you mean ?, something like ?: ↵https://github.com/super-linter/super-linter#super-linter |
19:29:04 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#ix=4I0f |
19:29:41 | * | antranigv joined #nim |
19:33:05 | FromDiscord | <Elegantbeef> More context would be better |
19:41:25 | FromDiscord | <.aingel.> Whats the standard way to report errors in a nim proc? Exceptions? |
19:42:36 | FromDiscord | <Elegantbeef> Exceptions are Nim's choice for error handling you can also use Sentinels, Options, Results, or any other error method though |
19:45:59 | FromDiscord | <.aingel.> Gotcha thanks! |
19:53:43 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#ix=4zIt |
19:53:59 | FromDiscord | <aintea> (edit) "https://play.nim-lang.org/#ix=4zIt" => "https://paste.rs/bBMMx" |
19:55:15 | FromDiscord | <Elegantbeef> What's the full error? |
19:55:55 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#ix=4I0j |
19:56:12 | FromDiscord | <Elegantbeef> `import std/json` in this module |
19:57:02 | FromDiscord | <aintea> no way i forgot to readd it after i removed it |
19:57:05 | FromDiscord | <aintea> thanks |
19:57:48 | FromDiscord | <Elegantbeef> You likely exported `JsonNode` in one of your other modules |
19:57:48 | FromDiscord | <Elegantbeef> But as you didnt export `[]` you only had the type |
19:59:45 | FromDiscord | <Elegantbeef> also there is a nice `/` operator inside `std/paths` and `std/os` |
19:59:53 | FromDiscord | <Elegantbeef> so you can just do `configpath / "songs_folder"` |
20:00:43 | FromDiscord | <Elegantbeef> No clue if this is supposed to support any other os but you also should likely use `getTempDir() / "songs_folder"` |
20:07:33 | FromDiscord | <Langosta> Does anybody know any good resources for network programming? |
20:07:50 | FromDiscord | <Langosta> I’ve found a few books, but they seem to be very lang specific at times |
20:09:41 | Amun-Ra | for C, there's https://beej.us/guide/bgnet/ |
20:12:07 | FromDiscord | <raynei486> it's not hard to translate it to Nim tbh |
20:12:25 | Amun-Ra | mhm |
20:15:46 | FromDiscord | <michaelb.eth> anyone read Beej's Guide to C Programming?↵I've never really learned C, just picked up stuff here and there, wondering if it's worth the time to work through it or there's a better resource/s |
20:18:13 | Amun-Ra | long time ago |
20:18:32 | FromDiscord | <varriount> In reply to @juancarlospaco "What do you mean": Pretty much, although the readme for super-linter is unclear as to whether it creates "suggestion" comments in the PR diffs, like this:↵https://github.com/nim-lang/Nim/pull/22701/files/5d92a2aa7e2f6d2eb760c9082f9fd46efa4a8d2e#r1326418741 |
20:18:45 | Amun-Ra | it was frequently recommended on ##C |
20:33:10 | FromDiscord | <sOkam! 🫐> In reply to @michaelb.eth "anyone read Beej's *Guide": Modern C |
20:33:27 | FromDiscord | <sOkam! 🫐> beej's guide is not bad, but modernc is much better and more complete, imo |
20:33:40 | FromDiscord | <sOkam! 🫐> his stuff in networking is pretty good though |
20:44:19 | FromDiscord | <.aingel.> So if I make a cpp wrapping for nim, I can have that compiled so when someone installs from nimble, they don't need to use the cpp backend anymore right? |
20:44:26 | FromDiscord | <.aingel.> They can use c or whatever else? |
20:44:52 | FromDiscord | <.aingel.> (edit) "So if I make ... alibrary," added "nim bindings for" | "wrapping for nim," => "library," |
20:45:21 | FromDiscord | <Elegantbeef> If you use `importcpp` it needs the C++ backend |
20:46:18 | FromDiscord | <Elegantbeef> What you need to do is make a stable FFI that can be used by any language to not need the C++ backend |
20:46:47 | FromDiscord | <Elegantbeef> Due to how C++ works you pretty much either need to remake a C++ compiler or use a C++ compiler to do a lot of the interop Nim gives you |
20:47:36 | FromDiscord | <.aingel.> Whoa um... |
20:48:22 | FromDiscord | <.aingel.> Are there any nimble libraries that wrap a cpp library? |
20:48:45 | FromDiscord | <.aingel.> So if you include that it forces your whole project to use the cpp compiler? |
20:48:50 | FromDiscord | <.aingel.> (edit) "compiler?" => "backend?" |
20:49:01 | FromDiscord | <.aingel.> I'm actually doing import c |
20:49:22 | FromDiscord | <.aingel.> Because there's a wrapper cpp file that makes a c header for the cpp stuff |
20:49:45 | FromDiscord | <.aingel.> So my nim code (for the wrapper) only uses importc, but it links to / compiles cpp |
20:49:56 | FromDiscord | <.aingel.> But it doesn't use importcpp |
20:49:59 | FromDiscord | <.aingel.> Would that be okay then? |
20:52:00 | FromDiscord | <my.narco> what the fuck 😭 https://media.discordapp.net/attachments/371759389889003532/1158506691097276566/image.png?ex=651c7eef&is=651b2d6f&hm=52466a7b7a2a97054810ab92628e7c8a320bc8a6b1ab26b55f3e72c5089fc101& |
20:54:04 | FromDiscord | <Elegantbeef> If you use importc on a c header you're not using C++ interop |
20:54:12 | * | advesperacit quit () |
20:54:31 | FromDiscord | <Elegantbeef> What the fuck the fuck? |
21:00:05 | * | rez joined #nim |
21:01:00 | FromDiscord | <Chronos [She/Her]> Hey all, how would I build docs for my library from Nimble?- |
21:01:35 | FromDiscord | <michaelb.eth> In reply to @heysokam "beej's guide is not": cool, thanks for the suggestion |
21:02:25 | FromDiscord | <michaelb.eth> In reply to @heysokam "Modern C": this one? https://www.manning.com/books/modern-c |
21:04:39 | FromDiscord | <raynei486> In reply to @my.narco "what the fuck 😭": building interpreter? |
21:05:04 | FromDiscord | <my.narco> In reply to @raynei486 "building interpreter?": building a compiler |
21:05:08 | FromDiscord | <sOkam! 🫐> In reply to @michaelb.eth "this one? https://www.manning.com/books/modern-c": yep! |
21:05:33 | FromDiscord | <my.narco> In reply to @raynei486 "building interpreter?": kind of like java compiles to javac and jvm runs javac. mine is noli compiles to nolic and nolivm runs nolic |
21:06:02 | FromDiscord | <Chronos [She/Her]> Someone spill the secrets to generating docs please 💀 |
21:06:42 | FromDiscord | <Elegantbeef> `nim doc` |
21:07:54 | FromDiscord | <Chronos [She/Her]> For the entire nimble project |
21:08:02 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I0v |
21:08:12 | FromDiscord | <Chronos [She/Her]> Thank you :D |
21:08:21 | FromDiscord | <Chronos [She/Her]> How does the git.url work? |
21:08:28 | FromDiscord | <sOkam! 🫐> your url |
21:08:35 | FromDiscord | <sOkam! 🫐> you just place it there 🤷♂️ |
21:08:56 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/docgen.html |
21:08:57 | FromDiscord | <sOkam! 🫐> the {} is not placeholder, is std/strformat |
21:09:09 | FromDiscord | <Chronos [She/Her]> Yeah thought so bc of the `&` |
21:09:35 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4I0w |
21:13:30 | FromDiscord | <Chronos [She/Her]> Thanks sOkam! |
21:14:13 | FromDiscord | <michaelb.eth> In reply to @heysokam "yep!": following the links here: https://gustedt.gitlabpages.inria.fr/modern-c/↵there's an edition of the book that can be freely downloaded, and the example code can be freely downloaded (see Download buttons on left side of pages)↵https://inria.hal.science/hal-02383654↵https://inria.hal.science/hal-03345464 |
21:18:35 | FromDiscord | <raynei486> In reply to @my.narco "kind of like java": interesting, got a repo? |
21:18:38 | FromDiscord | <my.narco> well i wrote a decompiler and.... i still cant find the problem! what the fuck, i mustve really done something wrong writing this code generator... https://media.discordapp.net/attachments/371759389889003532/1158513392877850714/image.png?ex=651c852d&is=651b33ad&hm=6f609dcde7d26263c790c4ade4b9f8cabebc019a389ce675bc6e4324e15326f0& |
21:18:43 | FromDiscord | <my.narco> In reply to @raynei486 "interesting, got a repo?": ah yeah its private though |
21:18:49 | FromDiscord | <my.narco> i will public it actually |
21:18:54 | * | rez quit (Quit: much snoozes...) |
21:19:37 | FromDiscord | <my.narco> In reply to @raynei486 "interesting, got a repo?": https://github.com/anthony-63/Noli |
21:20:29 | FromDiscord | <sOkam! 🫐> In reply to @michaelb.eth "following the links here:": yes, that's the one i read too, the one from hal that's freely available |
21:20:41 | FromDiscord | <michaelb.eth> okay, cool, good to hear |
21:28:29 | FromDiscord | <raynei486> @my.narco you can simplify a lot of your `exec.nim` with some simple templates |
21:28:34 | FromDiscord | <raynei486> a lot of code duplication |
21:28:42 | FromDiscord | <my.narco> In reply to @raynei486 "<@811230507408031774> you can simplify": im not sure how to use templates |
21:29:27 | FromDiscord | <my.narco> in that context atrleast |
21:29:50 | FromDiscord | <Chronos [She/Her]> Is it worth having a distinct type for UUIDs in my library? |
21:29:55 | FromDiscord | <Elegantbeef> You also could specific `?` as a operator to do `check_error` if you want to reduce the code noise 😄 |
21:29:58 | FromDiscord | <Chronos [She/Her]> It doesn't create, parse or generate them |
21:30:09 | FromDiscord | <Elegantbeef> Yes |
21:30:12 | FromDiscord | <my.narco> In reply to @Elegantbeef "You also could specific": can you write it out for me i still dont understand |
21:30:14 | FromDiscord | <Chronos [She/Her]> Alright |
21:31:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4I0y |
21:31:55 | FromDiscord | <Elegantbeef> It's not required but it's a possibillity if you wanted to reduce the `check_error` calls being so obtuse |
21:32:04 | FromDiscord | <my.narco> sent a code paste, see https://paste.rs/0V0wb |
21:33:36 | FromDiscord | <Chronos [She/Her]> My first library with actual docs! :p |
21:33:52 | FromDiscord | <Elegantbeef> `proc next(pu: var NoliPU): (uint64, NoliError)` ah someone really used Odin 😄 |
21:33:53 | FromDiscord | <Chronos [She/Her]> Just need a github action to build this now oof |
21:34:12 | FromDiscord | <Elegantbeef> It's very easy, just steal it from treeform's nimtemplate |
21:34:29 | FromDiscord | <my.narco> In reply to @Elegantbeef "`proc next(pu: var NoliPU):": yeah 😆 |
21:34:35 | FromDiscord | <my.narco> i have alot of time with odin |
21:34:40 | FromDiscord | <my.narco> but i have been enjoying nim more |
21:35:08 | FromDiscord | <Elegantbeef> Insert Mr.Burns saying excellent here |
21:35:11 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "It's very easy, just": Fair enough, I shall yoink it |
21:35:34 | FromDiscord | <Elegantbeef> Technically you also can remove the `()` as `?bleh` is a unary operator |
21:35:57 | FromDiscord | <Elegantbeef> @raynei486 might also suggest an example of their other template idea |
21:36:12 | FromDiscord | <Elegantbeef> Also you do not need to annotate procs as nimcall |
21:36:17 | FromDiscord | <Elegantbeef> That's the default calling convention |
21:36:22 | FromDiscord | <Elegantbeef> This isn't odin where that matters much |
21:36:47 | FromDiscord | <Elegantbeef> All top level procs unannotated are `nimcall` |
21:37:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4I0C |
21:38:29 | FromDiscord | <Elegantbeef> This means you do not need to do `NoLiVmCallTable[myOpCode.ord()](...)` |
21:38:31 | FromDiscord | <Chronos [She/Her]> Ah is `nim-version` something I need to define in my GitHub secrets? |
21:38:52 | FromDiscord | <Chronos [She/Her]> Used as `env.nim-version` is the template workflow |
21:39:04 | FromDiscord | <Elegantbeef> You just put the yml in the place and then it works |
21:39:04 | FromDiscord | <Elegantbeef> Nope chronos |
21:39:05 | FromDiscord | <Elegantbeef> You just do `NoliVmCallTable[myOpCode](...)` |
21:39:16 | FromDiscord | <Elegantbeef> Well after you point your pages to your gh-pages branch |
21:39:33 | FromDiscord | <Chronos [She/Her]> Hm |
21:40:05 | FromDiscord | <Chronos [She/Her]> Ah alright I get it now |
21:40:08 | FromDiscord | <.aingel.> In reply to @Elegantbeef "If you use importc": But I still need the cpp backend for this since I'm compiling cpp code |
21:40:18 | FromDiscord | <.aingel.> And I need the cpp stdlib for example |
21:40:18 | FromDiscord | <Chronos [She/Her]> But also my repo names are different from the package name lol, gotta fix that |
21:40:27 | FromDiscord | <my.narco> In reply to @Elegantbeef "Also instead of `seq[proc...]`": thank you for all of this |
21:40:52 | FromDiscord | <Elegantbeef> You also may want to do `ProcType myProcName` inside the array on the first element |
21:41:19 | FromDiscord | <Elegantbeef> This will cause all further elements to convert to that type |
21:41:37 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "But I still need": does that cpp library provide a c api? if so you could wrap that with nim and build the cpp separately into a static library and then link with it↵if not, you could write it↵and if that's not an option, then yeah you need your whole project to use the cpp backend |
21:42:03 | FromDiscord | <Elegantbeef> Odin and Nim are actually the only two modern languages I know of that have first class enum indexed arrays 😄 |
21:42:10 | FromDiscord | <Elegantbeef> Atleast iirc odin has enum indexed arrays |
21:42:27 | FromDiscord | <sOkam! 🫐> rust doesn't have them? |
21:43:22 | FromDiscord | <my.narco> In reply to @Elegantbeef "This means you do": i never had to do this though |
21:43:37 | FromDiscord | <my.narco> sent a code paste, see https://paste.rs/YfLEE |
21:43:57 | FromDiscord | <Elegantbeef> No rust hates ordinal enums |
21:43:59 | FromDiscord | <raynei486> In reply to @Elegantbeef "<@733059160924749855> might also suggest": I am looking for a type representing arithmetic operators 😅 |
21:44:05 | FromDiscord | <raynei486> I guess they're just procs? |
21:44:07 | FromDiscord | <sOkam! 🫐> you really 1000% are coming from a C-like lang, @my.narco jeez |
21:44:07 | FromDiscord | <Elegantbeef> All other langues require manual conversion |
21:44:08 | FromDiscord | <.aingel.> In reply to @heysokam "does that cpp library": I have wrote a c api for it |
21:44:23 | FromDiscord | <my.narco> In reply to @heysokam "you really 1000% are": ive been writing C since 10 years old :D |
21:44:31 | FromDiscord | <sOkam! 🫐> yeah i can see that for sure |
21:44:31 | FromDiscord | <.aingel.> When I build the cpp though it still needs the cpp backend |
21:44:57 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "When I build the": how are you building it? |
21:45:05 | FromDiscord | <Elegantbeef> They came from Odin, so that's not C like! |
21:45:18 | FromDiscord | <my.narco> In reply to @Elegantbeef "They came from Odin,": but before odin i was a C developer |
21:45:31 | FromDiscord | <.aingel.> In reply to @heysokam "how are you building": clang++ |
21:45:43 | FromDiscord | <.aingel.> U know maybe it's cause my c API needs cpp |
21:45:48 | FromDiscord | <Elegantbeef> Sorry for your loss |
21:45:49 | FromDiscord | <Elegantbeef> Manual memory managment more like RAII exists |
21:45:55 | FromDiscord | <.aingel.> But once I build the c api I might not need the cpp backend anymore |
21:46:15 | FromDiscord | <sOkam! 🫐> In reply to @.aingel. "clang++": but how are you calling clang++... by `{.compile: ...}` pragmas, by cmake, by their buildsystem... building into a dynamic lib, static lib, etc |
21:51:55 | FromDiscord | <.aingel.> In reply to @heysokam "but how are you": ` clang++ -c -o simdjson.cpp cysimdjsonc.cpp -std=c++11` |
21:51:56 | FromDiscord | <.aingel.> Like this |
21:52:19 | FromDiscord | <.aingel.> And then doing {.include.} for the .o files |
21:52:30 | FromDiscord | <.aingel.> (edit) "{.include.}" => "{.link.}" |
21:58:31 | FromDiscord | <Chronos [She/Her]> Pain |
21:58:33 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4I0F |
21:58:48 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4I0G |
21:59:00 | FromDiscord | <Chronos [She/Her]> That's the related code, not sure how to handle this exactly tbh |
21:59:02 | FromDiscord | <Elegantbeef> Oh nice a compiler crash |
21:59:03 | FromDiscord | <Elegantbeef> `import std/json` though |
21:59:52 | FromDiscord | <Chronos [She/Her]> I have |
21:59:56 | FromDiscord | <Chronos [She/Her]> In the actual code I have |
22:00:44 | FromDiscord | <raynei486> why is it so hard to generate procedures with templates? |
22:03:04 | FromDiscord | <Chronos [She/Her]> Yep i am struggling with this, why do I bother with type safety |
22:04:43 | * | def- quit (Quit: -) |
22:05:26 | * | def- joined #nim |
22:06:55 | FromDiscord | <Chronos [She/Her]> Sigh... Perfect |
22:07:48 | FromDiscord | <Chronos [She/Her]> Beef I blame you |
22:07:51 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://paste.rs/rTTmN |
22:10:00 | FromDiscord | <Chronos [She/Her]> Putting the import in there fixed it but if they;re using the module, it's obviously already imported :/ |
22:13:15 | FromDiscord | <.aingel.> can I link cpp compiled .o files and only use the c backend if I'm only using importc? |
22:13:18 | FromDiscord | <.aingel.> It doesn't seem to work for me |
22:13:20 | FromDiscord | <Langosta> In reply to @Amun-Ra "for C, there's https://beej.us/guide/bgnet/": This is exactly what I sought. Thank you |
22:13:50 | FromDiscord | <.aingel.> Oh wait I think I need to use the stdlib as a static library or something |
22:14:22 | FromDiscord | <raynei486> In reply to @.aingel. "can I link cpp": c++ mangles its names so maybe that could be an issue |
22:19:08 | FromDiscord | <Elegantbeef> It's not↵(@raynei486) |
22:21:05 | FromDiscord | <raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4I0Q |
22:21:21 | FromDiscord | <raynei486> I'm not sure how to pass an operator into a template |
22:21:25 | FromDiscord | <raynei486> or what type it should be |
22:21:37 | FromDiscord | <Elegantbeef> `op(1, 2)` |
22:23:05 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4I0R |
22:23:26 | FromDiscord | <Elegantbeef> Alternatively you can just do `op: untyped` |
22:23:28 | FromDiscord | <raynei486> oh 💀 |
22:23:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/RWo0s |
22:24:03 | FromDiscord | <raynei486> damn that's pretty clean |
22:24:14 | FromDiscord | <raynei486> almost reminds me of preprocessor |
22:26:22 | * | lumo_e joined #nim |
22:36:32 | FromDiscord | <.aingel.> In reply to @raynei486 "c++ mangles its names": I think it's the issue that I need to statically-link the std c++ |
22:36:48 | FromDiscord | <.aingel.> Otherwise it wants to dynamically link it, and therefore i'll have to use the cpp backend |
22:37:29 | * | LuxuryMode joined #nim |
22:41:39 | FromDiscord | <raynei486> thanks beef |
22:41:39 | FromDiscord | <raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4I0S |
22:42:00 | FromDiscord | <raynei486> I can open a PR |
22:42:10 | FromDiscord | <my.narco> In reply to @raynei486 "<@811230507408031774> This can be": vthank you! |
22:59:51 | FromDiscord | <Elegantbeef> For a different VM solution |
22:59:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4I0V |
23:00:00 | FromDiscord | <Elegantbeef> If implemented it would make implementing op codes quite ergonomic |
23:00:20 | FromDiscord | <Elegantbeef> But it requires using Macros and they are fun |
23:00:21 | FromDiscord | <raynei486> yeah a better macro would be neat |
23:00:28 | FromDiscord | <raynei486> but this is the crude solution |
23:00:36 | FromDiscord | <raynei486> @my.narco I opened a PR btw |
23:00:46 | FromDiscord | <Elegantbeef> Yea the template is fine for getting around the chore |
23:01:18 | FromDiscord | <Elegantbeef> Plus if they do not need the procs callable elsewhere they can just embed them directly into the array |
23:01:51 | FromDiscord | <Elegantbeef> It doesnt really seem that they need these procedures elsewhere |
23:02:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4I0W |
23:04:58 | FromDiscord | <.aingel.> how do I link with an .so file that I made with g++ |
23:05:12 | FromDiscord | <.aingel.> I'm trying {.link.} and -passL but doesn't seem to be working |
23:05:25 | FromDiscord | <Elegantbeef> Either use Nim's `dynlib` annotation or `--passL:"-lname"` |
23:06:24 | FromDiscord | <.aingel.> I tried the passL with -lname |
23:06:44 | FromDiscord | <Elegantbeef> Did you also supply `-L` to add your library path to the search path? |
23:06:45 | FromDiscord | <.aingel.> if I have it as libjson.so in my current directory should -ljson work? |
23:06:54 | FromDiscord | <.aingel.> I put -L as the fullpath of my working dir |
23:06:57 | FromDiscord | <Elegantbeef> Yes |
23:07:10 | FromDiscord | <.aingel.> nim c --passL:"-L/Users/saint/code/gemmaJSON -ljson" gemmaJSON.nim |
23:07:16 | FromDiscord | <.aingel.> So this basically |
23:07:45 | FromDiscord | <Elegantbeef> Sure |
23:07:54 | FromDiscord | <.aingel.> Doesn't seem to be working though |
23:08:00 | FromDiscord | <.aingel.> Can't find the symbols that are referenced there |
23:08:07 | FromDiscord | <.aingel.> (edit) "referenced" => "located" |
23:08:08 | FromDiscord | <.aingel.> In the lib |
23:08:31 | FromDiscord | <Elegantbeef> `nm -gD /your/lib.so` |
23:09:52 | FromDiscord | <.aingel.> uh oh |
23:09:54 | FromDiscord | <.aingel.> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: error: libcat.so: File format has no dynamic symbol table |
23:12:12 | FromDiscord | <.aingel.> `g++-13 -shared -o libjson.so cysimdjsonc.o simdjson.o -static-libstdc++ -static-libgcc` |
23:12:21 | FromDiscord | <.aingel.> I'm creating my shared lib this way |
23:19:40 | FromDiscord | <demotomohiro> iirc, Linux doesn't search current directory when loading shared lib. |
23:34:43 | FromDiscord | <.aingel.> In reply to @demotomohiro "iirc, Linux doesn't search": I can confirm I think its finding it cause if I change the -L dir to a fake one it complains it cant find it and if I change the -ljson to something fake it complains too |
23:35:03 | FromDiscord | <.aingel.> Are there any big disadvantages to using the cpp backend? |
23:35:19 | FromDiscord | <.aingel.> I'm trying to make this library be able to be used with the c backend instead of having it to be tied to the cpp |
23:35:25 | FromDiscord | <.aingel.> Idk if there's a point in that |
23:50:10 | FromDiscord | <my.narco> In reply to @raynei486 "<@811230507408031774> I opened a": i merged your PR, thank you very much! |
23:50:15 | FromDiscord | <my.narco> this helps me alot with learning |