00:14:33 | * | azimut quit (Ping timeout: 246 seconds) |
00:26:55 | FromDiscord | <breadpudding> So I have updated my compiler to 2.0 and now my kernel won't build. It keeps saying I need to port the memory manager to my platform and I can't convince it that I can't `malloc`/`free` memory when I'm an operating system. |
00:28:11 | FromDiscord | <odexine> Compile flags? |
00:28:23 | FromDiscord | <breadpudding> sent a code paste, see https://play.nim-lang.org/#ix=4Gjd |
00:32:28 | FromDiscord | <odexine> I think that OS should say standalone instead of any |
00:32:36 | FromDiscord | <michaelb.eth> In reply to @millymox "Installed checksums and it": fwiw, the docs seem a bit messed up, you can replace `src/checksums/sha1` with `std/sha1` and it works |
00:32:37 | FromDiscord | <odexine> Not sure exactly though |
00:32:57 | FromDiscord | <breadpudding> I was using standalone on 1.6 and it started giving me a linking error so I decided to try `os:any` |
00:33:21 | FromDiscord | <breadpudding> Here's the old arguments: https://github.com/cbpudding/mapledos/blob/main/kernel/mapledos.nim.cfg |
00:34:13 | FromDiscord | <breadpudding> sent a code paste, see https://play.nim-lang.org/#ix=4Gjf |
00:36:33 | FromDiscord | <odexine> I don’t see that file it references in the repo? |
00:37:53 | FromDiscord | <breadpudding> Just committed my unfinished code |
00:41:34 | FromDiscord | <odexine> I have bets that it’s related to your massive arrays |
00:41:49 | FromDiscord | <odexine> Not sure what causes it exactly aside from that though |
00:41:50 | FromDiscord | <breadpudding> Probably... |
00:42:57 | * | genr8eofl__ is now known as genr8eofl |
00:44:55 | FromDiscord | <breadpudding> Still dies when I delete my entire LUT |
00:45:48 | FromDiscord | <odexine> Seems like a libc is needed |
00:45:55 | FromDiscord | <odexine> In any case |
00:47:27 | FromDiscord | <nervecenter> sent a long message, see http://ix.io/4Gjg |
00:47:36 | FromDiscord | <nervecenter> (edit) "http://ix.io/4Gjg" => "http://ix.io/4Gjh" |
00:48:31 | FromDiscord | <breadpudding> Actually, something interesting... I can do it in the `nim` packaged with Arch, but I can't do it with `choosenim`, even if I select the exact version I used before... |
00:48:48 | FromDiscord | <nervecenter> It's a tradeoff and I think people who take the "easy" choice of jumping to Rust (from any number of other smaller languages) are making a pretty bad choice. There's been a lot of writing already as well about how Rust's memory and data structure semantics lock you into your design pretty hard and make refactors a pain in the ass. |
00:48:56 | FromDiscord | <nervecenter> (edit) "tradeoff" => "tradeoff," |
00:49:17 | FromDiscord | <breadpudding> As someone who used to program in Rust, that's one of the reasons why I'm moving away from it. |
00:49:34 | FromDiscord | <odexine> In reply to @breadpudding "Actually, something interesting... I": What do you mean? |
00:49:42 | FromDiscord | <odexine> Did I skip a message by mistake |
00:49:45 | FromDiscord | <breadpudding> Same error on `nim` 1.6.10 |
00:50:48 | FromDiscord | <breadpudding> Aaaaand switching back to my distro's packaged Nim causes the same error |
00:50:57 | FromDiscord | <breadpudding> Now I'm confused about how I got it to build in the first place |
00:53:56 | FromDiscord | <nervecenter> It's funny because Rust was originally supposed to look a lot more like Nim, just with a more ML-life flavor, and somehow the systems crowd took over the project. The poor guy who made the language often sounds like someone who totally lost the reins of his baby to other people. |
00:54:08 | FromDiscord | <nervecenter> (edit) "ML-life" => "ML-like functional" |
00:54:29 | FromDiscord | <breadpudding> I actually really liked Rust back in 2017... and then it just got overly complicated. |
01:08:32 | * | xaltsc quit (Server closed connection) |
01:09:00 | * | xaltsc joined #nim |
01:31:42 | FromDiscord | <millymox> Rust is just too verbose and I feel like the learning curve isn’t worth it, it’s a cool langauge I can see it’s strength but I don’t have the time or patience to dive deep into, the benefits aren’t that good atleast for me |
02:02:06 | FromDiscord | <Elegantbeef> `-d:useMalloc`?↵(@breadpudding) |
02:02:10 | FromDiscord | <Elegantbeef> Or am I daft |
02:02:25 | FromDiscord | <breadpudding> I don't think you can use `malloc` if it doesn't exist. |
02:02:33 | FromDiscord | <Elegantbeef> You can use malloc then override it to your implementation |
02:02:39 | FromDiscord | <breadpudding> True... |
02:02:54 | FromDiscord | <Elegantbeef> https://github.com/Yardanico/mimalloc_nim is an example doing that with mimalloc |
02:03:09 | FromDiscord | <Elegantbeef> Of course you would use your own allocator, but same difference |
02:04:14 | FromDiscord | <Elegantbeef> For the time being you could make the allocation procs no ops |
02:31:43 | FromDiscord | <Haze System (they/them)> sent a code paste, see https://play.nim-lang.org/#ix=4GjC |
02:32:55 | FromDiscord | <Elegantbeef> Like i said you cannot do runtime indexing with tuples |
02:33:06 | FromDiscord | <Haze System (they/them)> ohhh |
02:33:18 | FromDiscord | <Haze System (they/them)> didnt know what that meant at the time |
02:34:22 | FromDiscord | <leorize> see if `-fstack-check` is in gcc's command line↵(@breadpudding) |
02:34:53 | FromDiscord | <leorize> pass `-fno-stack-check` to disable that feature |
02:44:30 | FromDiscord | <breadpudding> I ended up reverting a commit to fix the issue |
02:44:37 | FromDiscord | <breadpudding> I'll keep that in mind for the future |
02:58:39 | FromDiscord | <Haze System (they/them)> sent a code paste, see https://play.nim-lang.org/#ix=4GjH |
02:58:44 | FromDiscord | <Elegantbeef> `mobs.mitems` |
02:58:52 | FromDiscord | <Haze System (they/them)> ahh right, thank you |
03:34:30 | FromDiscord | <ravinder387> sent a code paste, see https://play.nim-lang.org/#ix= |
03:34:50 | FromDiscord | <ravinder387> sent a code paste, see https://play.nim-lang.org/#ix= |
03:35:20 | FromDiscord | <Elegantbeef> Holy shit we're still on this |
03:35:58 | FromDiscord | <Elegantbeef> Actually sorry, this is not command syntax but block syntax |
03:36:00 | FromDiscord | <Elegantbeef> So you get a pass |
03:36:19 | FromDiscord | <ravinder387> it was add 1,2 this is different |
03:36:49 | FromDiscord | <ravinder387> https://media.discordapp.net/attachments/371759389889003532/1151723195104243763/Screenshot_2023-09-14_090613.png |
03:37:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GjM |
03:38:20 | FromDiscord | <Langosta> sent a code paste, see https://play.nim-lang.org/#ix=4GjN |
03:38:53 | FromDiscord | <Elegantbeef> The code works even without the space |
03:39:11 | FromDiscord | <Langosta> hmm |
03:41:03 | FromDiscord | <ravinder387> it works.. nim's syntax is very interesting |
03:41:31 | FromDiscord | <Elegantbeef> It's not nearly interesting enough to spend months starring at a single slide |
03:41:57 | FromDiscord | <Langosta> Honestly, I would be careful about using too much sugar. You'll get cavities |
03:42:30 | FromDiscord | <Langosta> but also, It's not like I'm uber experienced, so take me with a dose of salt |
03:42:39 | FromDiscord | <Elegantbeef> It's not even really syntax sugar just alternative syntax |
03:44:33 | FromDiscord | <odexine> In reply to @alendrik "but also, It's not": Too much salt is bad for you too though |
03:48:49 | FromDiscord | <ravinder387> In reply to @Elegantbeef "It's not nearly interesting": it takes me to understand almost 7 month |
03:51:20 | FromDiscord | <ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4GjW |
03:52:39 | FromDiscord | <ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4GjX |
03:53:01 | FromDiscord | <ravinder387> template is also a function |
03:53:37 | FromDiscord | <ravinder387> repeat and statement is arguments of template |
04:41:20 | FromDiscord | <Phil> In reply to @nervecenter "I did not say": In that case this is a case of misinterpretation from me based on the context of the discussion.↵Which was terry joking that Pmunch switched lang and you typing an honest question about why he'd do so which I interpreted as a rhetorical question of "Of course he'd switch" |
04:41:25 | FromDiscord | <Phil> Thus my bad, I apologize |
04:55:18 | * | ntat joined #nim |
05:01:12 | * | junaid_ joined #nim |
05:47:42 | FromDiscord | <ravinder387> stack overflow survey 2023 out . anybody see |
05:52:40 | * | rockcavera quit (Remote host closed the connection) |
06:08:32 | * | ox joined #nim |
06:09:14 | * | oz quit (Ping timeout: 246 seconds) |
06:27:59 | * | advesperacit joined #nim |
06:33:34 | * | PMunch joined #nim |
06:56:46 | PMunch | Ooh link? |
07:03:44 | FromDiscord | <xtrayambak> https://survey.stackoverflow.co/2023/ |
07:08:14 | PMunch | "Why complicate it? Jira and Confluence are the top two async tools amongst all developers similar to last year". We stopped using Jira at work because it was at the same time too complicated and not able to do some simple things we wanted. |
07:08:43 | FromDiscord | <gogolxdong666> https://media.discordapp.net/attachments/371759389889003532/1151776526954676234/ft.nim |
07:09:24 | FromDiscord | <gogolxdong666> Anyone helps to see why it leaks memory so bad? |
07:09:36 | PMunch | Uhm, why does it import modules more than once? |
07:10:19 | PMunch | Have you tried passing it through Valgrind? |
07:10:19 | FromDiscord | <Elegantbeef> Can never be too certain |
07:10:27 | PMunch | `import json; import json; import json goddamnit!` |
07:11:15 | FromDiscord | <gogolxdong666> sorry🥲 |
07:12:10 | FromDiscord | <Elegantbeef> I'll write an RFC for `nowReallyImport` |
07:12:30 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Gkx |
07:12:43 | FromDiscord | <sOkam! 🫐> My first idea is the `new ObjectType` in there, but... 🤷♂️ |
07:13:24 | FromDiscord | <gogolxdong666> let's focus on the memory issue. |
07:15:50 | FromDiscord | <Elegantbeef> Sokam sounds like accidentally using UB |
07:16:13 | FromDiscord | <sOkam! 🫐> what part of it could be causing it? |
07:16:44 | FromDiscord | <Elegantbeef> Due to strict aliasing i'm always weary of `cast[ptr T](x.addr)` |
07:18:53 | PMunch | Again, if you are looking for memory leaks, ask Valgrind.. |
07:19:05 | FromDiscord | <sOkam! 🫐> ah i see. yeah but the chained behavior works like that. what's the alternative to that cast? |
07:19:14 | PMunch | It will tell you what memory is leaking, and where it was allocated |
07:19:27 | FromDiscord | <Elegantbeef> compile with `-d:useMalloc --debugger:native` when using valgrind |
07:19:42 | PMunch | `nim c --debugger:native -d:useMalloc myproject.nim; valgrind --leak-check=full ./myproject` |
07:19:48 | FromDiscord | <Elegantbeef> I mean there isnt an alternative |
07:19:54 | FromDiscord | <sOkam! 🫐> in C you basically coerce the type into that slot, and then wgpu/vulkan knows the type and size of the actual contents by checking the sType field |
07:20:16 | FromDiscord | <Elegantbeef> well descriptor is a stack object and you're returning an address to it |
07:20:39 | FromDiscord | <sOkam! 🫐> isn't it allocated by doing `new` though? |
07:20:54 | FromDiscord | <Elegantbeef> So then you do not want to do `descriptor. addr` |
07:20:59 | FromDiscord | <Elegantbeef> you want to just cast the ref to a pointer |
07:21:32 | FromDiscord | <Elegantbeef> `new` heap allocates making a `ref T` |
07:21:41 | FromDiscord | <Elegantbeef> Atleast if you're using the builtin new |
07:21:41 | PMunch | I wonder what the sample size on this is: "Zig is the highest-paid language to know this year (a new addition)" |
07:21:54 | FromDiscord | <sOkam! 🫐> so it would be `cast[ptr ChainedStruct](descriptor)` instead? |
07:21:57 | FromDiscord | <Elegantbeef> There are like 10 zig devs |
07:22:01 | FromDiscord | <nnsee> In reply to @PMunch "I wonder what the": at least 2 |
07:22:01 | FromDiscord | <Elegantbeef> I kid of course |
07:22:04 | FromDiscord | <Elegantbeef> Yes |
07:22:11 | FromDiscord | <sOkam! 🫐> i will try |
07:22:11 | * | xmachina quit (Ping timeout: 252 seconds) |
07:22:41 | * | xmachina joined #nim |
07:22:46 | PMunch | But yeah, I imagine it's a bit like the Nim space. Not a whole lot of devs, so a few people who are paid well will pull up the average quite much |
07:22:51 | FromDiscord | <nnsee> In reply to @PMunch ""Why complicate it? Jira": what did you migrate to? |
07:22:53 | FromDiscord | <Elegantbeef> You were casting a pointer to the stack instead of the pointer to the heap |
07:23:03 | FromDiscord | <Elegantbeef> Insert "wait you're getting paid" meme here |
07:23:31 | FromDiscord | <nnsee> treeform is getting paid pretty big bucks to write nim at reddit i believe |
07:23:36 | PMunch | nnsee, nothing yet. We had been using Microsoft Planner (I know.. But it's included in our Office plans) so we just sorta drifted back to that |
07:24:10 | FromDiscord | <sOkam! 🫐> you are a wizard, beef |
07:24:18 | PMunch | I mean I also primarily write Nim, and I get paid quite handsomely, but the two aren't really correlated :P |
07:24:18 | FromDiscord | <sOkam! 🫐> that worked, tysm (as per usual) |
07:24:21 | FromDiscord | <Elegantbeef> You are a wizard harry |
07:24:58 | FromDiscord | <Elegantbeef> I should start shaking a cup outside |
07:25:39 | FromDiscord | <nnsee> In reply to @PMunch "I mean I also": same, and I'm not even a developer of any kind |
07:25:39 | FromDiscord | <sOkam! 🫐> now I wonder how that even worked on gcc |
07:26:02 | FromDiscord | <Elegantbeef> You got lucky the stack was valid |
07:26:25 | FromDiscord | <sOkam! 🫐> i guess so |
07:26:35 | PMunch | Elegantbeef, come to think of it I have no idea what you do. But you should get with the cool kids and do cup shaking online |
07:27:15 | FromDiscord | <Elegantbeef> Well I do nothing really |
07:27:59 | PMunch | Nothing? |
07:28:55 | FromDiscord | <Elegantbeef> Yes |
07:29:17 | FromDiscord | <sOkam! 🫐> I'm curious too. Are you retired, or something like that? |
07:29:43 | FromDiscord | <Elegantbeef> I refer to myself as a pretend caregiver |
07:30:03 | FromDiscord | <xtrayambak> In reply to @gogolxdong666 "": don't exceptions leak memory or smt? |
07:30:06 | PMunch | Pretend? |
07:30:09 | FromDiscord | <xtrayambak> I think I saw an issue on the issue tracker |
07:30:11 | FromDiscord | <xtrayambak> about this |
07:30:24 | FromDiscord | <xtrayambak> it was labelled gamestopper but it's still open |
07:30:33 | PMunch | Yup: https://github.com/nim-lang/Nim/issues/22672 |
07:30:44 | FromDiscord | <Elegantbeef> Yea I don't get paid, i'm unemployed and help my disabled parents |
07:30:53 | PMunch | To be fair that one is only about a week old |
07:30:58 | FromDiscord | <xtrayambak> In reply to @Elegantbeef "Yea I don't get": that's hard |
07:31:02 | FromDiscord | <sOkam! 🫐> ah gotcha |
07:31:07 | FromDiscord | <Elegantbeef> Eh it's not |
07:31:29 | FromDiscord | <xtrayambak> how do ya get money if you're unemployed? |
07:31:32 | PMunch | Elegantbeef, ah that's not great, but good on you for taking care of them |
07:31:56 | FromDiscord | <sOkam! 🫐> In reply to @xtrayambak "how do ya get": sounds like family mutual support |
07:32:15 | FromDiscord | <xtrayambak> it's nice that you take care of them |
07:32:38 | FromDiscord | <xtrayambak> I've seen a lot of people who just abandon their parents when they're not paid |
07:32:43 | FromDiscord | <xtrayambak> atleast in India |
07:34:04 | FromDiscord | <xtrayambak> In reply to @PMunch "Yup: https://github.com/nim-lang/Nim/issues/22672": I've seen a lot of stuff not designed for ARC suddenly leaking memory |
07:34:12 | FromDiscord | <xtrayambak> I'm pretty sure Nitter also leaks memory if you set the GC to ARC |
07:35:36 | PMunch | Well that's fairly normal, there's bound to be some issues |
07:36:17 | PMunch | I'm curious how many projects will stop leaking when this exception stuff is patched |
07:37:51 | PMunch | Neat, Nim made the list of programming languages. We have a measly 0.40% though, but still! |
07:40:30 | FromDiscord | <xtrayambak> the year of the nim programming language is nearing |
07:40:42 | FromDiscord | <xtrayambak> hopefully we don't become the linux of programming languages xD |
07:41:41 | FromDiscord | <xtrayambak> btw, does anyone work full time on Nim, or is everyone a hobbyist? |
07:41:46 | FromDiscord | <xtrayambak> I'm curious to know xd |
07:42:21 | PMunch | On Nim as in making the language? There are a couple people on the payroll, yes |
07:42:24 | Amun-Ra | I'm not even a professional programmer |
07:43:48 | FromDiscord | <xtrayambak> In reply to @PMunch "On Nim as in": Ah, I thought it was a bunch of hobbyists lol |
07:45:21 | FromDiscord | <xtrayambak> Once I'm above 18 and get some sort of job I'll nag the living life out of my employers to use Nim until they either fire me or succumb to my demands :P |
07:45:59 | Amun-Ra | since when junior programmers have anything to say in the matter? ;) |
07:47:00 | PMunch | The trick is to just start using it for small internal stuff, then slowly but surely bring it on to bigger projects |
07:47:17 | Amun-Ra | ^ this |
07:49:53 | FromDiscord | <xtrayambak> In reply to @Amun-Ra "since when junior programmers": I'll probably join a startup, then |
07:49:59 | FromDiscord | <xtrayambak> sounds stupid but that'll probably work |
07:50:23 | FromDiscord | <xtrayambak> unless the person running the startup is a starbucks loving mac fanboy who swears by JavaScript |
07:50:36 | FromDiscord | <xtrayambak> In reply to @PMunch "The trick is to": this sounds less insane though |
07:52:30 | Amun-Ra | never go full, erm, insane |
07:54:11 | FromDiscord | <xtrayambak> I have a patent on being insane |
07:54:17 | FromDiscord | <xtrayambak> don't ya try to snatch that from me |
07:54:49 | FromDiscord | <xtrayambak> when I was new to Nim, I tried to import `lupa` using `nimpy` so that I could run lua code in Nim where everything Lua did was returned as a `PyObject` |
07:54:53 | FromDiscord | <xtrayambak> does that tell you how insane I am |
07:57:26 | * | junaid_ quit (Remote host closed the connection) |
07:59:33 | * | ntat quit (Quit: leaving) |
08:33:31 | FromDiscord | <odexine> but why |
08:33:34 | FromDiscord | <odexine> nim has lua bindings |
09:04:56 | PMunch | *insert glory of satan meme* |
09:05:33 | PMunch | I swear I reference this meme too much in real life, pretty sure some people think I'm an actual Satanist.. |
09:17:06 | FromDiscord | <Phil> You're not? I've been lied to? |
09:17:11 | FromDiscord | <Phil> (edit) "to?" => "to!" |
09:19:15 | FromDiscord | <frobnicate> In reply to @xtrayambak "btw, does anyone work": Hobby |
09:28:07 | FromDiscord | <Clonkk> The hardest part of convincing an employer is getting other people on board. If you work alone as a dev in a small company, it's rather easy to make your own technological choice. The problem is when you work with other peole, they will have to use Nim too. And that's them you need to convince & possibly train first. If a good portion of the dev teams is on board for switching technology, usually management follow.↵(@xtrayambak) |
09:50:39 | * | azimut joined #nim |
09:55:42 | FromDiscord | <enthus1ast> The trick is to be the only real it guy and just use it everywhere |
10:14:19 | FromDiscord | <okabintaro> sent a long message, see http://ix.io/4Gl7 |
10:14:52 | FromDiscord | <okabintaro> (edit) "http://ix.io/4Gl7" => "http://ix.io/4Gl8" |
10:14:56 | FromDiscord | <Phil> PMunch!↵I would like to have your opinion on this one! |
10:15:04 | FromDiscord | <Phil> Its regarding destructors with owlkettle |
10:20:01 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Gl9 |
10:20:40 | FromDiscord | <Phil> I'm basically on noob levels when it comes to destructors so I'll take whatever input I can to get a more complete picture of what I can and can't do 😅 |
10:26:41 | PMunch | What would you catch? |
10:27:01 | PMunch | g_object_unref wouldn't raise any Nim exception |
10:27:05 | PMunch | So it would never catch anything |
10:27:43 | FromDiscord | <Phil> Do exceptions raised in C not get passed on to nim somehow? Like a Db always raises DbError? |
10:28:14 | PMunch | Which exceptions? C doesn't have exceptions.. |
10:28:44 | FromDiscord | <Phil> Err.... fair point, given that I have not written any C code I keep subconsciously assuming it does |
10:29:55 | PMunch | Oh, and by the way. Why do you have `PixBuf = ref PixbufObj`? |
10:30:16 | PMunch | Your PixbufObj holds a pointer, so it's already kind of a reference type |
10:31:28 | PMunch | In fact since it only has one field, which is a pointer, it would be stored in memory exactly the same way a normal pointer would |
10:31:58 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Glc |
10:32:29 | FromDiscord | <Phil> The code originally used a "finalizer" which did work with ref-types |
10:32:39 | FromDiscord | <Phil> (edit) "The code originally used a "finalizer" ... which" added "(previous iteration of destructors?)" |
10:33:14 | PMunch | That's what I do in my MAPM wrapper, I have a `MapmInternal` which comes from Futhark and is the underlying pointer type. Then I have `Mapm = object` which only holds a `MapmInternal`. This means that `Mapm` is basically just a pointer, but Nim will treat it as an object. Now with `=destroy` and `=copy` I implement freeing of the internal pointer and copying (through `m_apm_copy` or whatever it was called). |
10:33:37 | PMunch | Yeah finalizers became destructors I believe |
10:35:10 | PMunch | I'm not 100% sure how passing by value works though, my MAPM library might copy the object over and over for every function it passes it into.. |
10:36:04 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Gle |
10:36:42 | FromDiscord | <Phil> Because I am not nearly good enough to actually predict the changes that may occur from changing the semantics of Pixbuf as a pointer-wrapper from ref-type to value-type semantics |
10:38:29 | FromDiscord | <Phil> Though at a glance it doesn't seem like that breaks things |
10:40:06 | PMunch | Hmm, might be good to keep it as a reference object.. |
10:43:01 | PMunch | Some more research on this topic is required I think. But yeah, just keep it as a reference object for now |
10:45:34 | FromDiscord | <Phil> In reply to @PMunch "Some more research on": I'll point it out in the owlkettle issue that it seems functional and ask for his opinion, which likely will be to keep it for now but at least the idea went through his mind to see if its worthwhile or not 😄 |
10:45:50 | FromDiscord | <Phil> (edit) "In reply to @PMunch "Some more research on": I'll point it out in the owlkettle issue that it seems functional and ask for his opinion, which likely will be to keep it ... for" added "as ref" |
10:49:34 | * | PMunch_ joined #nim |
10:52:39 | * | PMunch quit (Ping timeout: 252 seconds) |
10:54:43 | PMunch_ | Sorry I lost connection there for a sec |
10:54:58 | PMunch_ | Last I saw was the "I'll point it out in the owlkettle issue" comment |
10:55:13 | FromDiscord | <Phil> Yeh didn't type anything else in the meantime |
11:13:07 | FromDiscord | <toma400> sent a code paste, see https://play.nim-lang.org/#ix=4Glk |
11:13:33 | FromDiscord | <toma400> sent a code paste, see https://play.nim-lang.org/#ix=4Gll |
11:15:24 | PMunch_ | Well.. |
11:15:27 | PMunch_ | Not like that |
11:17:57 | PMunch_ | This would work, where it not for the two swords: https://play.nim-lang.org/#ix=4Glm |
11:18:48 | PMunch_ | This works: https://play.nim-lang.org/#ix=4Glo |
11:19:59 | PMunch_ | You could of course create a neater system for this |
11:21:17 | FromDiscord | <toma400> What `shl` stands for? |
11:21:25 | PMunch_ | Shift left |
11:24:00 | FromDiscord | <toma400> Thank you. I'm not entirely on details, but I see how this works in general shape.↵Is this because enums only can take primitive types as value, so arrays/tuples are not supported, or what is exactly the reasoning behind my way not working? |
11:24:04 | FromDiscord | <toma400> (edit) "Thank you. I'm not entirely ... on" added "sure" |
11:24:28 | PMunch_ | Pretty much, yes |
11:24:42 | PMunch_ | Enums can only hold integers and/or strings |
11:25:16 | PMunch_ | They get an int value implicitly, and the string value would just be the stringification of their identifier by default |
11:25:40 | PMunch_ | But you can do `EnumVal = (1, "First")` to set the int and string explicitly |
11:25:52 | PMunch_ | What this does is basically create a bitmap |
11:27:14 | PMunch_ | So first we give each of the class values their own bit which indicates that they are set, then for the Subclass enum we combine these bits into new numbers. Then to extract if a Subclass is has a bit set we need to use `and` so `if Battleaxe.int and Axe.int != 0` means that Battleaxe has the Axe bit set |
11:29:00 | PMunch_ | So with a normal 64-bit int you would only be able to store 64 different things this way |
11:31:50 | PMunch_ | You could of course get jiggy with it: https://play.nim-lang.org/#ix=4Glq |
11:33:27 | PMunch_ | Or you could consider doing a lookup table |
11:34:12 | PMunch_ | I wrote a bit about making lookup tables more readable here: https://peterme.net/metaprogramming-and-read-and-maintainability-in-nim.html |
11:34:16 | * | PMunch_ is now known as PMunch |
11:34:20 | PMunch | toma400 ^ |
11:42:01 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4Glt |
11:44:14 | PMunch | Look like an ORC bug |
11:45:23 | FromDiscord | <enthus1ast> what exactly does the acyclic pragma? |
11:50:34 | PMunch | The acyclic pragma does |
11:51:25 | PMunch | Just kidding, it tells Nim that a reference can't create a cycle, so there is no need for ORC to scan it |
11:51:57 | PMunch | In a doubly linked list you shouldn't create a cycle, that's what linked rings are for, so the references are annotated acyclic |
11:55:23 | FromDiscord | <enthus1ast> so they should be annotated |
11:55:24 | FromDiscord | <enthus1ast> ? |
11:55:33 | FromDiscord | <enthus1ast> but its missing in the current version |
11:59:18 | PMunch | Ah but they have cursor |
11:59:36 | PMunch | Wait, that wouldn't help though.. |
11:59:39 | FromDiscord | <toma400> sent a code paste, see https://play.nim-lang.org/#ix=4Glw |
12:00:35 | PMunch | Uhm, that would be quite expensive.. |
12:00:44 | FromDiscord | <toma400> (edit) "https://play.nim-lang.org/#ix=4Glw" => "https://play.nim-lang.org/#ix=4Gly" |
12:00:51 | FromDiscord | <toma400> (edit) "https://play.nim-lang.org/#ix=4Gly" => "https://play.nim-lang.org/#ix=4Glz" |
12:01:00 | FromDiscord | <toma400> (edit) "https://play.nim-lang.org/#ix=4Glz" => "https://play.nim-lang.org/#ix=4GlA" |
12:01:03 | PMunch | Creating a small table like that and checking if something is contained within it is a very Pythonic way of doing it :P |
12:02:11 | FromDiscord | <toma400> Can't fight my origin xP↵I will try to learn proper Nim one day, I promise 😅 |
12:02:48 | FromDiscord | <enthus1ast> This is also a rather mystery to me↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
12:04:16 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4GlB |
12:04:25 | FromDiscord | <enthus1ast> then the table is created on compile time |
12:06:15 | PMunch | I actually did some testing recently with a table of string keys, just searching a sequence of key/value tuples linearly in a sequence is faster than getting keys from a table up to around 15 keys. |
12:07:03 | FromDiscord | <enthus1ast> i also did some experiments with a "perfect hash function" searcher |
12:07:04 | PMunch | And the keys would be densely packed unlike a Table, so memory footprint should be lower |
12:07:14 | PMunch | Perfect hash function searcher? |
12:07:38 | FromDiscord | <enthus1ast> a perfect hash function is a hash function (for a given input) that does not generate collisions |
12:07:47 | FromDiscord | <enthus1ast> and is very fast |
12:08:01 | PMunch | Right |
12:09:51 | FromDiscord | <enthus1ast> mhh i forgot the name of the hash function... |
12:09:55 | FromDiscord | <enthus1ast> one sec |
12:10:04 | FromDiscord | <Chronos [She/Her]> In reply to @enthus1ast "a perfect hash function": Wouldn't that have to be the length of the original input as a minimum? |
12:10:10 | FromDiscord | <Chronos [She/Her]> To guarantee uniqueness? |
12:10:30 | FromDiscord | <enthus1ast> only for a given input |
12:10:38 | FromDiscord | <enthus1ast> so eg you know all the keys beforehand |
12:10:54 | FromDiscord | <enthus1ast> then you can find a hash function that never create collisions for the given set of keys |
12:11:24 | FromDiscord | <Nelson> imagen.png https://media.discordapp.net/attachments/371759389889003532/1151852698191265872/imagen.png |
12:12:07 | FromDiscord | <toma400> In reply to @enthus1ast "then the table is": Dang, forgot it is const variables that can't use procs, not procs that can't contain consts :o |
12:12:07 | PMunch | Uhm, `1 >> 1`? |
12:12:09 | FromDiscord | <toma400> Thank you! |
12:12:17 | FromDiscord | <toma400> (edit) ":o" => ":o↵Thank you!" |
12:12:37 | PMunch | `const` "variables" can use procs, the procs just have to be compile-time :P |
12:12:38 | FromDiscord | <Nelson> what would be the right way to do something like this in Nim? |
12:12:39 | FromDiscord | <Nelson> Like, an enum where every value maps out to bits in an integer |
12:12:58 | FromDiscord | <toma400> In reply to @PMunch "`const` "variables" can use": True ^^ |
12:12:59 | PMunch | Nelson, scroll up a bit, we just discussed this actually :) |
12:13:31 | PMunch | Nelson, something along these lines: https://play.nim-lang.org/#ix=4Glo |
12:13:41 | PMunch | But they are right shifting, which is a bit suspect |
12:14:37 | PMunch | The two values there would be 1 and 0. If you added another value and did `1 >> 2` you'd also have 0 and a nice little collision on your hands |
12:14:40 | FromDiscord | <enthus1ast> in the c# example on the wiki page, you must just find a `const byte[] T` that creates a no collisions with your input values |
12:14:54 | FromDiscord | <enthus1ast> this can be done in an automatic fashion |
12:17:37 | FromDiscord | <Nelson> Ha!↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
12:17:51 | FromDiscord | <enthus1ast> in my experiments i just created those bytes ranomly, until it did not produce a collision, then my own hashtable was \~4 times faster than table |
12:17:52 | FromDiscord | <Nelson> whoops, did not sleep well yesterday lol↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
12:18:06 | PMunch | Oh, that's your code :P |
12:18:09 | FromDiscord | <Nelson> valid, makes sense↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
12:18:12 | PMunch | I thought you where porting something :) |
12:18:22 | FromDiscord | <Nelson> oh that's interesting |
12:18:32 | FromDiscord | <Nelson> nim uses shl |
12:18:42 | * | blop_ quit (Ping timeout: 246 seconds) |
12:18:54 | PMunch | Of course, in Nim you would get an error if you tried to put two of the same numbers into an enum, so at least here you would catch your bug before it created too much mayhem :) |
12:19:05 | FromDiscord | <Nelson> I... kind of am? It's the first time i try this structure and I just wanted to know if I could get it to work \:)↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
12:19:11 | FromDiscord | <Nelson> thanks!↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
12:19:55 | * | blop_ joined #nim |
12:27:55 | FromDiscord | <Chronos [She/Her]> I'm half tempted to do something with the library I made for handling (basic) MC packets |
12:29:30 | FromDiscord | <Chronos [She/Her]> Though I want to work on something else...just not sure what |
12:29:59 | FromDiscord | <toma400> I wish there was pragma to allow duplicate strings/ints or even non-ordinal types, in exchange for less usability of the enum |
12:30:21 | FromDiscord | <toma400> It'd be at least interesting to have them so flexible |
12:30:27 | FromDiscord | <Chronos [She/Her]> Hey Beef, you around? Do you think it's possible to serialise the state of the wasm3 interpreter to resume at a later moment in time? The main issue is just figuring out how to pause and resume, right? |
12:33:45 | PMunch | toma400, you can have duplicate strings, but how would duplicate ints work? The int is the ID of the enum, so you would now have one ID pointing to two different things? |
12:38:35 | FromDiscord | <Chronos [She/Her]> What would be the best way of defining a type from C that stores a string, in Nim? Is there something I can use to convert them easily or should I just make a setter/getter for the user so they can use Nim strings seemlessly while the type actually stores a cstring? |
12:39:32 | FromDiscord | <Chronos [She/Her]> Fuck it, I'm gonna just use Futhark to save myself the headache |
12:45:13 | FromDiscord | <Chronos [She/Her]> This is odd- Clang is installed on my system but ld can't find it |
12:45:29 | FromDiscord | <Chronos [She/Her]> Oh wait maybe bc I'm cmpiling with gcc |
12:46:25 | PMunch | You can still use Futhark with GCC |
12:46:54 | PMunch | I mean Futhark uses clang and Opir requires libclang, but you can compile your Futhark'd wrapper with Gcc |
12:47:47 | FromDiscord | <Chronos [She/Her]> Hm then yeah idk why the linker can't find clang |
12:48:09 | FromDiscord | <Chronos [She/Her]> When installing Futhark: `/usr/bin/ld: cannot find -lclang: No such file or directory` |
12:48:15 | PMunch | Are you on Ubuntu? |
12:48:29 | PMunch | It installs libclang in some crazy folder out of the search tree |
12:48:35 | * | junaid_ joined #nim |
12:48:50 | FromDiscord | <Chronos [She/Her]> On an Archlinux distro, used pacman t install it |
12:49:06 | FromDiscord | <Chronos [She/Her]> There's no folder for libclang in /usr/include tho so |
12:51:35 | PMunch | Hmm, strange |
12:51:45 | FromDiscord | <Chronos [She/Her]> Yeaah |
12:51:50 | * | ntat joined #nim |
12:51:58 | PMunch | `pacman -Ql clang | grep libclang.so` |
12:53:06 | FromDiscord | <Chronos [She/Her]> ..ah you know what's strange? :p |
12:53:14 | FromDiscord | <Chronos [She/Her]> I ran pacman install and it didn't install- |
12:53:29 | FromDiscord | <Chronos [She/Her]> Wait what |
12:53:33 | FromDiscord | <Chronos [She/Her]> It says it's installed |
12:53:41 | FromDiscord | <Chronos [She/Her]> But it's not even on path? |
12:55:11 | FromDiscord | <Chronos [She/Her]> Okay well I just installed `clang` instead of `clang15` and it works so- |
12:55:25 | FromDiscord | <Chronos [She/Her]> Futhark now works lol |
12:55:46 | PMunch | Nice |
12:58:38 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4GlT |
12:59:52 | PMunch | You shouldn't, as long as you have the header you should be good |
13:00:05 | PMunch | And you shouldn't have to pass `sysPath`, it should be automatically detected |
13:01:21 | PMunch | Is it possible to run one test with Nimble? |
13:01:53 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4GlW |
13:01:56 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "Is it possible to": I could, sure |
13:02:16 | PMunch | Chronos_[She/Her], that question wasn't really for you :P |
13:02:31 | PMunch | I meant if there is a way to run just one of the tests in a Nimble package |
13:02:37 | FromDiscord | <Chronos [She/Her]> Ah sorry- |
13:02:57 | PMunch | Where is `speaklib.h` located? |
13:03:20 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "I meant if there": Seems like it though, if you just put the file name after it |
13:03:53 | FromDiscord | <Chronos [She/Her]> Nvm nope |
13:04:19 | FromDiscord | <Chronos [She/Her]> I tried that but yeah I put the one that would've been ran first anyway lol |
13:04:30 | FromDiscord | <Chronos [She/Her]> `/usr/include/espeak-ng` |
13:04:33 | PMunch | Haha, yeah I can't get it to work |
13:04:37 | FromDiscord | <Chronos [She/Her]> That's where speaklib is found |
13:04:42 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "Haha, yeah I can't": Sorry :p |
13:05:30 | PMunch | I believe `path "/usr/include/espeak-ng"` and then just `"speaklib.h"` should work |
13:05:52 | FromDiscord | <Chronos [She/Her]> That's what I'm doing now but no dice |
13:06:00 | PMunch | Oh wait, maybe it has to be `espeak-ng/speaklib.h` |
13:06:08 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4GlY |
13:06:11 | FromDiscord | <Chronos [She/Her]> In reply to @PMunch "Oh wait, maybe it": Also tried that before too |
13:07:14 | PMunch | That's because it's called speak_lib.h... |
13:07:34 | PMunch | It helps to use the correct filenames ;) |
13:07:52 | PMunch | This compiles for me: http://ix.io/4Gm1 |
13:08:07 | FromDiscord | <Chronos [She/Her]> ... 🤦♀️ sorry about thataha |
13:08:27 | FromDiscord | <Chronos [She/Her]> I suffer from chronically stupid :p |
13:08:44 | FromDiscord | <Chronos [She/Her]> That indeed works now aha |
13:08:58 | FromDiscord | <ravinder387> No worry I forgive you |
13:09:19 | PMunch | Haha, no worries. Good to know I was actually correct and Futhark did indeed work as expected |
13:09:27 | PMunch | Ey, you forgive him? |
13:10:46 | FromDiscord | <Chronos [She/Her]> Haha |
13:13:29 | * | junaid_ quit (Remote host closed the connection) |
13:33:21 | * | oprypin quit (Read error: Connection reset by peer) |
13:35:59 | * | oprypin joined #nim |
13:38:32 | FromDiscord | <Phil> How in the everliving hell did I completely blank on the official docs having edit buttons |
13:42:44 | PMunch | Haha, I know! |
13:48:16 | FromDiscord | <Phil> PMunch, what exactly is a File Descriptor?↵Particularly in the context of AsyncFD.↵Like is it a file-handle, aka a ref to use with the file-system to be able to read the contents of an actual file? |
13:48:50 | FromDiscord | <Phil> I know it's a distinct int, I'm just trying to add a doc comment to the type and explain its actual meaning a bit as Async File Descriptor is not all that insanely meaningful to a newly introduced person like me |
13:49:07 | FromDiscord | <Phil> (edit) "read" => "fetch" |
13:51:44 | FromDiscord | <Phil> Actually, I just found the answer: https://stackoverflow.com/questions/5256599/what-are-file-descriptors-explained-in-simple-terms↵↵Then next question, what distinguishes an Async FD from a normal FD? |
13:52:15 | PMunch | Nothing really, apart from AsyncFD having been opened with the non-blocking flag |
13:52:19 | FromDiscord | <Phil> Both seem to be integers, so if you were to interact with the OS with an int you know is an asyncfd in the OS filesystem, then you can know that it'll block your thread to read from that thing? |
13:54:17 | FromDiscord | <Phil> In reply to @PMunch "Nothing really, apart from": So basically what is the implication there?↵What happens if you open a file of an AsyncFD before a value is behind that descriptor (aka you're still waiting for the file content)? |
13:54:46 | PMunch | Not sure what you mean |
13:55:16 | PMunch | If you've gotten as AsyncFD the file is created, otherwise the OS wouldn't give you a file descriptor |
13:55:22 | PMunch | I believe |
13:55:57 | FromDiscord | <Phil> So if I have an FD, I open the file, I get contents, I am happy.↵I assume AsyncFD is happy.↵I get an AsyncFD to a file that, let's say, I request via network. Now I open the file behind the AsyncFD, what possible scenarios are there and how do they differ from normal FD scenarios? |
13:56:04 | FromDiscord | <Phil> (edit) "happy.↵I" => "different.↵I" |
13:56:37 | PMunch | I'm not sure I follow what you mean.. |
13:56:43 | FromDiscord | <Phil> Or is this all just distinguished because there are some procs you only want to use with an AsyncFD and not a normal FD |
13:57:04 | FromDiscord | <Phil> I'm really trying to nail down the differences between an AsyncFD and a normal FD as I would experience them in code |
13:57:23 | FromDiscord | <Phil> (edit) "I'm really trying to nail down the differences between an AsyncFD and a normal FD as I would experience them in code ... " added "while programming" |
13:58:03 | PMunch | Yeah, in C you would just have to remember that your file is opened with O_NONBLOCK and make sure to treat read and write in an async fashion. In Nim this information is "stored" in the type through the distinction between AsyncFD and FD and Nim will pick the correct course of action to deal with the file |
13:58:19 | PMunch | Note: On Linux everything is a file, so a socket could also be a file |
14:00:01 | FromDiscord | <Phil> Is there a normal "FileDescriptor"-type? |
14:04:11 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Gmk |
14:04:21 | FromDiscord | <Phil> Yes |
14:04:40 | FromDiscord | <Phil> Keep in mind even the nimble file is in the end kinda just nimscript with a few extras |
14:05:14 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Gml |
14:06:06 | FromDiscord | <Phil> So when-defined flags should similarly work.↵Just make sure that every use of espeakUseFuthark-dependant features is hidden behind a similar when flag |
14:06:13 | FromDiscord | <Chronos [She/Her]> Great! |
14:06:20 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "So when-defined flags should": Yep that's what I'm doing! |
14:10:03 | * | PMunch quit (Quit: Leaving) |
14:19:19 | FromDiscord | <leorize> unless you're on windows |
14:26:10 | NimEventer | New question by vijay shankar: Removing Console window in Nim, see https://stackoverflow.com/questions/77105843/removing-console-window-in-nim |
14:27:54 | * | jmdaemon quit (Ping timeout: 246 seconds) |
14:31:22 | * | rockcavera joined #nim |
14:49:56 | FromDiscord | <Chronos [She/Her]> Is that in regards to me or? |
14:50:58 | * | rockcavera quit (Read error: Connection reset by peer) |
14:51:44 | * | rockcavera joined #nim |
14:51:44 | * | rockcavera quit (Changing host) |
14:51:44 | * | rockcavera joined #nim |
14:57:30 | * | LyndsySimon quit (Ping timeout: 258 seconds) |
14:57:37 | * | robertmeta quit (Read error: Connection reset by peer) |
14:57:37 | * | notchris quit (Write error: Connection reset by peer) |
14:57:59 | * | ormiret quit (Ping timeout: 245 seconds) |
14:59:38 | * | notchris joined #nim |
14:59:45 | * | LyndsySimon joined #nim |
15:00:00 | * | ormiret joined #nim |
15:00:42 | * | robertmeta joined #nim |
15:01:04 | * | robertmeta quit (Changing host) |
15:01:04 | * | robertmeta joined #nim |
15:02:06 | FromDiscord | <Phil> Time to make a lot of tiny doc comment PRs |
15:10:07 | * | krux02 joined #nim |
15:16:23 | arkanoid | every version update, I spend more time fighting vscode working with nim than writing actual code |
15:17:03 | arkanoid | I have my project building and tests passing at command line, but vscode shows 254 errors |
15:17:43 | FromDiscord | <.grimrippa> I'm trying out nimx, on windows but it says sdl2.dll cannot be found? |
15:22:23 | FromDiscord | <.grimrippa> got it to work by getting sdl2 in the directory containing the exe |
15:29:48 | FromDiscord | <_gumbercules> that's how shared libraries on Windows work |
15:31:23 | FromDiscord | <_gumbercules> gotta have the shared library (dll) in the linker's search path |
15:32:51 | arkanoid | found the culprit, is not vscode, but nim itself. nim c project.nim succeeds, nim check project.nim tons of errors |
15:40:33 | arkanoid | got it, it is due to how nim c and nimble looks for deps, and the pkgs vs pkgs2 thing |
15:42:03 | arkanoid | so the issue in vscode is whatever it uses to check code looks for project deps differently than nimble |
15:45:29 | * | junaid_ joined #nim |
15:46:59 | arkanoid | so that if I have pinned a dependency version in my nimble file, nimble build would work as it looks into pkgs2 folder, but if a version of the same library exists in pkgs folder, nim check would look there and then fails |
15:49:28 | arkanoid | solved by wiping conflicting libs in pkgs folder |
15:50:23 | arkanoid | the strategy used by nimble and nim to search for deps should be 1:1, otherwise these thing will happen a lot |
15:50:59 | FromDiscord | <xtrayambak> In reply to @odexine "nim has lua bindings": I didn't know nimble.directory or `nimble search` existed |
15:50:59 | FromDiscord | <xtrayambak> lol |
15:53:54 | * | ox is now known as oz |
15:56:33 | FromDiscord | <odexine> oh rip |
16:04:09 | FromDiscord | <taperfade> In reply to @m4ul3r "Winim is just a": where can i learn |
16:04:14 | FromDiscord | <taperfade> abt it |
16:07:28 | FromDiscord | <raynei486> https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-api-list |
16:09:11 | FromDiscord | <taperfade> wtf |
16:09:20 | FromDiscord | <taperfade> theres so much |
16:11:21 | FromDiscord | <raynei486> well it's the whole index |
16:11:32 | FromDiscord | <taperfade> idk what i need to read |
16:11:36 | FromDiscord | <taperfade> theres so |
16:11:39 | FromDiscord | <taperfade> much |
16:11:42 | FromDiscord | <raynei486> maybe better place to start |
16:11:43 | FromDiscord | <raynei486> https://learn.microsoft.com/en-us/windows/win32/ |
16:11:45 | FromDiscord | <leorize> just look for some win32 gui guide or something |
16:11:45 | FromDiscord | <m4ul3r> Windows is massive, but pretty much the windows internals good is a good start for windows system programming |
16:12:15 | FromDiscord | <taperfade> all code examples are in c |
16:12:21 | FromDiscord | <taperfade> 😔 |
16:12:45 | FromDiscord | <raynei486> time to learn C 😛 |
16:12:50 | FromDiscord | <taperfade> nope |
16:12:58 | FromDiscord | <taperfade> not interested |
16:13:15 | FromDiscord | <raynei486> honestly very okay if you're interested in knowing what things are really like |
16:13:22 | FromDiscord | <raynei486> helps you appreciate high level stuff |
16:13:39 | FromDiscord | <leorize> if you use winim the API you use is C API |
16:13:47 | FromDiscord | <raynei486> also the world and every library runs on C (terrible) |
16:14:49 | FromDiscord | <m4ul3r> Just translate it to nim. The winim wrapper wraps c 🤷♂️ |
16:15:13 | FromDiscord | <raynei486> yeah |
16:16:20 | FromDiscord | <taperfade> also |
16:16:21 | FromDiscord | <taperfade> https://media.discordapp.net/attachments/371759389889003532/1151914341646467163/image.png |
16:16:32 | FromDiscord | <taperfade> c compiler refuses to work |
16:16:37 | FromDiscord | <taperfade> didnt work in linux too |
16:17:33 | FromDiscord | <taperfade> i lost all my motivation to code |
16:17:36 | FromDiscord | <taperfade> literally |
16:17:38 | FromDiscord | <taperfade> in this minute |
16:19:23 | FromDiscord | <raynei486> your mingw installation might be borked |
16:19:28 | FromDiscord | <raynei486> how did it not work in Linux? |
16:19:33 | FromDiscord | <taperfade> idk |
16:19:37 | FromDiscord | <taperfade> wait ill boot linux |
16:20:16 | FromDiscord | <taperfade> i must be a masochist |
16:20:22 | FromDiscord | <taperfade> using linux |
16:20:24 | FromDiscord | <taperfade> yuck |
16:20:26 | FromDiscord | <raynei486> programming is masochistic lol |
16:20:32 | FromDiscord | <raynei486> if you make it that wat |
16:20:35 | FromDiscord | <raynei486> (edit) "wat" => "way" |
16:20:40 | FromDiscord | <taperfade> spits on the floor |
16:20:47 | FromDiscord | <taperfade> ok brb |
16:22:42 | FromDiscord | <raynei486> what distro are you using? |
16:23:31 | FromDiscord | <taperfade> debian |
16:23:56 | FromDiscord | <taperfade> i hate how it looks https://media.discordapp.net/attachments/371759389889003532/1151916250008662036/image.png |
16:24:03 | FromDiscord | <taperfade> i tried so hard to make it look decent |
16:24:40 | FromDiscord | <raynei486> you can install a distro that looks good by default wat |
16:25:46 | FromDiscord | <taperfade> wdym |
16:25:53 | FromDiscord | <taperfade> all of them look ass |
16:25:54 | FromDiscord | <taperfade> lmao |
16:25:58 | FromDiscord | <leorize> head to r/unixporn and make your pick |
16:30:14 | FromDiscord | <taperfade> nvm got it to work on linux |
16:30:28 | FromDiscord | <taperfade> In reply to @leorize "head to r/unixporn and": no |
16:30:34 | FromDiscord | <taperfade> i need a reason to hate on linux ppl |
16:30:53 | FromDiscord | <taperfade> also win11 needs no "ricing" to look amazing |
16:31:13 | FromDiscord | <taperfade> 🤷🏼♀️ |
16:33:15 | FromDiscord | <leorize> sounds like you already know what to use |
16:33:22 | * | jmdaemon joined #nim |
16:49:27 | FromDiscord | <kingterrytheterrible12> i think im just gonna switch to debian |
16:59:38 | FromDiscord | <frobnicate> In reply to @arkanoid "every version update, I": I have a dev container with Ubuntu that works with the language server and nimsaem if you want |
17:00:41 | arkanoid | frobnicate, thanks but this would not solve the issue. As long as you use choosenim + nimble, and you have your deps in pkgs and pkgs2 folders, you have to deal with this |
17:01:15 | FromDiscord | <odexine> that's why i recommend not to use nimble 0.14;) |
17:01:17 | FromDiscord | <odexine> (edit) "0.14;)" => "0.14 😉" |
17:01:30 | FromDiscord | <frobnicate> Hmm? |
17:01:51 | FromDiscord | <frobnicate> You don't need choosenim if you're in a container? |
17:02:12 | FromDiscord | <kingterrytheterrible12> In reply to @odexine "that's why i recommend": what happen to kanon |
17:03:44 | arkanoid | well, pkgs and pkgs2 are an issue introduced by jumping back and forth 1.x and 2.x, and this would be ok given the major bump. The issue is how vscode doesn't seems to know which dependency to pick if it exists in both folders, even if the project uses nimble and nim 2.0 |
17:04:22 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/cqu7V |
17:04:29 | FromDiscord | <enthus1ast> so if one wants to test feel free \:) |
17:05:24 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4Gne |
17:05:25 | FromDiscord | <frobnicate> In reply to @arkanoid "well, pkgs and pkgs2": You wouldn't have that issue in a container. There's only one version per container |
17:06:17 | FromDiscord | <frobnicate> And it's not vscode. It's whatever extensions you use. Most likely nimsaem. It works fine with the language server and v2 |
17:06:42 | FromDiscord | <frobnicate> This is why dev containers are practical |
17:10:16 | FromDiscord | <taperfade> guys |
17:10:21 | FromDiscord | <taperfade> idk what to do |
17:11:01 | FromDiscord | <leorize> what do you want to do? |
17:17:32 | FromDiscord | <taperfade> idk |
17:17:39 | FromDiscord | <saint._._.> Does anyone know how to pass a callback into C code from nim? |
17:17:57 | FromDiscord | <leorize> make a callback and attach `{.cdecl.}` to it↵(@saint._._.) |
17:17:58 | FromDiscord | <taperfade> malicious software but u guys dont like talking abt that |
17:18:01 | FromDiscord | <leorize> then just pass its name |
17:18:04 | FromDiscord | <saint._._.> I'm having some problems with it, because the C code expects a callback of a certain type, and I'm not sure I'm casting my nim function into that type |
17:18:09 | FromDiscord | <leorize> you can't use any closure feature |
17:18:18 | FromDiscord | <saint._._.> @leorize I'm doing that but I'm getting a type mismatch |
17:18:35 | FromDiscord | <leorize> then you'll need to post the message here |
17:18:50 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Gnh |
17:18:53 | FromDiscord | <_gumbercules> In reply to @taperfade "malicious software but u": go make your own server to talk about it in then |
17:19:01 | FromDiscord | <_gumbercules> be the change you want to see in the world |
17:19:02 | FromDiscord | <saint._._.> So it's expecting a type of `lexbor_serialize_cb_f` |
17:19:15 | FromDiscord | <saint._._.> `type lexbor_serialize_cb_f {.importc.} = proc (data: ptr lxb_char_t, len: cint, ctx: pointer ): cint {.cdecl.}↵` |
17:19:17 | FromDiscord | <griffith1deadly> In reply to @_gumbercules "be the change you": and get ban from discord |
17:19:20 | FromDiscord | <saint._._.> This is the import |
17:19:22 | FromDiscord | <_gumbercules> that's not on me |
17:19:27 | FromDiscord | <saint._._.> `proc printcb (data: ptr lxb_char_t, len: int, ctx: pointer): cint {.cdecl.} =↵` |
17:19:31 | FromDiscord | <saint._._.> And that is my nim function |
17:19:39 | FromDiscord | <saint._._.> It has the same function params |
17:19:40 | FromDiscord | <leorize> `int` -\@saint._._.) |
17:20:05 | FromDiscord | <saint._._.> Ohh |
17:20:08 | FromDiscord | <griffith1deadly> int are int64, cint = int32 |
17:20:08 | FromDiscord | <saint._._.> That fixed something |
17:20:12 | FromDiscord | <saint._._.> Gotcha |
17:20:22 | FromDiscord | <saint._._.> Thank u so much already |
17:20:33 | FromDiscord | <saint._._.> Back in the days on irc if you asked a question like that they would first ask you |
17:20:37 | FromDiscord | <saint._._.> "What are you trying to do" |
17:20:42 | FromDiscord | <saint._._.> And then again what are you really trying to do |
17:20:45 | FromDiscord | <saint._._.> Are you sure you need callbacks |
17:20:53 | FromDiscord | <saint._._.> And son |
17:21:00 | FromDiscord | <saint._._.> (edit) "son" => "so on" |
17:21:04 | FromDiscord | <saint._._.> 😆 |
17:21:43 | arkanoid | frobnicate: which language server are you talking about? |
17:22:15 | arkanoid | btw, I'm interested in testing out the container. Is it free/open source? |
17:22:24 | FromDiscord | <griffith1deadly> https://github.com/nim-lang/langserver |
17:22:26 | FromDiscord | <griffith1deadly> maybe this? |
17:29:24 | arkanoid | I've heard polarized opinions on that. The overall point seems that it's a wrapper of nimsuggests that just adds more ways to fail than nimsuggest itself |
17:31:18 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Gnl |
17:31:36 | FromDiscord | <saint._._.> Is it an issue with unsigned char to const unsigned char ? |
17:31:40 | FromDiscord | <taperfade> <:GO_catStanding:1133402101205192734> |
17:31:53 | FromDiscord | <saint._._.> Why is the type unsigned int () |
17:31:59 | FromDiscord | <saint._._.> I'm not familiar with that |
17:32:02 | FromDiscord | <taperfade> Im so lost |
17:32:11 | FromDiscord | <taperfade> Idk what to work on |
17:32:23 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Gnn |
17:32:27 | FromDiscord | <saint._._.> This is the typedef of the callback in C |
17:32:39 | FromDiscord | <saint._._.> lxb_status_t is just an int |
17:32:41 | FromDiscord | <saint._._.> int enum |
17:32:54 | FromDiscord | <saint._._.> unsigned int |
17:33:15 | FromDiscord | <leorize> what's the nim prototype for it? |
17:33:42 | FromDiscord | <saint._._.> `type lexbor_serialize_cb_f {.importc.} = proc (data: ptr lxb_char_t, len: csize_t, ctx: pointer ): cint {.cdecl.}↵` |
17:34:05 | FromDiscord | <saint._._.> And this is the actual proc I'm passing |
17:34:05 | FromDiscord | <saint._._.> `proc printcb (data: ptr lxb_char_t, len: csize_t, ctx: pointer): cint {.cdecl.} =↵` |
17:34:17 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Gno |
17:34:47 | FromDiscord | <leorize> because it's not needed under the sink invariant |
17:35:22 | FromDiscord | <Phil> Assume I know nothing about nothing because I actually don't.↵What is the sink invariant? |
17:36:14 | FromDiscord | <Phil> And Why is it not needed? Or is it best for my sanity that I just assume "magic, source will lose access to its contents via other mechanisms that'll also be called that I don't need to know about" ? |
17:42:20 | FromDiscord | <leorize> the sink idea is that data go in and the origin is gone |
17:42:21 | FromDiscord | <leorize> you can never access the origin again |
17:42:22 | FromDiscord | <leorize> so yes, it's "magic" |
17:42:28 | FromDiscord | <leorize> basically a protocol where we all agree that it will never be accessed again |
17:43:00 | FromDiscord | <leorize> implementation wise, Nim emit a wasMoved() for the source anyways because that makes destructors simpler |
17:43:37 | FromDiscord | <Phil> So basically nim on its own will take care of the source no longer getting access, so within the sink proc my only job is to copy over from source what I need |
17:43:47 | FromDiscord | <Phil> (edit) "access," => "access and getting destroyed," |
17:43:47 | FromDiscord | <leorize> yes |
17:43:53 | FromDiscord | <leorize> I mean, look at the sink prototype |
17:44:02 | FromDiscord | <leorize> you /can't/ edit the source even if you wanted to |
17:44:12 | FromDiscord | <Phil> Ah, fair |
17:46:27 | FromDiscord | <toma400> In reply to @taperfade "malicious software but u": First fix all 1001 false flagging of Nim software by Defender, then come back to that topic 😉 |
17:46:28 | FromDiscord | <saint._._.> @leorize Any idea about my callback problem? |
17:49:24 | FromDiscord | <leorize> try cuint for the return value |
17:49:25 | FromDiscord | <leorize> this is definitely not making a lot of sense hmm |
17:49:27 | FromDiscord | <leorize> how do you call this function in nim? |
17:50:20 | FromDiscord | <griffith1deadly> In reply to @leorize "try cuint for the": yep, compiler says that lexbor_serialize_cb_f (return type) is uint |
17:50:33 | FromDiscord | <griffith1deadly> (edit) "uint" => "uint, not int" |
17:50:41 | FromDiscord | <saint._._.> In reply to @leorize "how do you call": Oh wait, so I think this might be the issue, it's that the c typedef is to a pointer, not the function |
17:51:09 | FromDiscord | <saint._._.> In reply to @leorize "try cuint for the": Oh does cuint make a dif |
17:51:10 | FromDiscord | <saint._._.> Maybe |
17:51:20 | FromDiscord | <saint._._.> `typedef lxb_status_t↵(lexbor_serialize_cb_f)(const lxb_char_t data, size_t len, void ctx);↵` |
17:51:30 | FromDiscord | <saint._._.> I thought this was the issue that it's a pointer to the function |
17:51:47 | FromDiscord | <saint._._.> Idk if that makes a dif or not |
17:52:38 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Gnv |
17:52:42 | FromDiscord | <saint._._.> Changed to cuint and got this |
17:52:45 | FromDiscord | <saint._._.> I thin kit's the pointer thing |
17:52:51 | FromDiscord | <saint._._.> (edit) "thin kit's" => "think it's" |
17:53:18 | FromDiscord | <frobnicate> In reply to @arkanoid "I've heard polarized opinions": No it doesn't? It works fine for me |
17:53:36 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4Gnw |
17:53:54 | FromDiscord | <frobnicate> In reply to @arkanoid "btw, I'm interested in": Yes. One sec. It does need glibc. I forgot to push that change. |
17:54:18 | FromDiscord | <leorize> all function types are pointers fwiw |
17:54:35 | arkanoid | frobnicate, no hurry. I'm alien to dev containers, so this would be the icebreaker |
17:54:38 | FromDiscord | <frobnicate> https://github.com/AFaurholt/nim-sdl2-cross/blob/main/.devcontainer/Dockerfile |
17:55:04 | FromDiscord | <frobnicate> Just add glibc before you start adding the lang server |
17:58:13 | FromDiscord | <frobnicate> Then you can run it with the dev container extension for vscode |
17:58:48 | FromDiscord | <frobnicate> Just tag the image as nim_sdl:latest or whatever I called it in the .devcontaier |
18:00:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4GnA |
18:01:49 | FromDiscord | <saint._._.> https://forum.nim-lang.org/t/7640 |
18:01:53 | FromDiscord | <saint._._.> I'm following basically this |
18:05:34 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GnC |
18:05:41 | FromDiscord | <saint._._.> Because right now I am not including the header file for my import for this specifically |
18:05:53 | FromDiscord | <saint._._.> I'm just doing `type lexbor_serialize_cb_f {.importc.} = proc (data: ptr lxb_char_t, len: csize_t, ctx: pointer ): cuint {.cdecl.}↵` |
18:15:54 | FromDiscord | <saint._._.> yo I got it to work |
18:16:07 | FromDiscord | <saint._._.> I was passing the function pointer in wrong, I was just including the function name |
18:16:12 | FromDiscord | <leorize> https://play.nim-lang.org/#ix=4GnG \<- testing here shows clear result |
18:16:13 | FromDiscord | <leorize> so not sure what's wrong with yours |
18:16:35 | FromDiscord | <leorize> but that's... how you do it? |
18:16:59 | FromDiscord | <Phil> Actually, another question, are guard clauses somehow regarded as bad? |
18:17:04 | FromDiscord | <Phil> (edit) "bad?" => "bad style?" |
18:17:21 | FromDiscord | <saint._._.> I think that's cause u aren't using this c lib @leorize |
18:17:31 | FromDiscord | <saint._._.> I had to cast the function pointer |
18:17:45 | FromDiscord | <leorize> I'm pretty much using the same C as that lib |
18:17:47 | FromDiscord | <leorize> so... |
18:17:49 | FromDiscord | <saint._._.> Thats how I got it to work |
18:17:49 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GnH |
18:17:50 | FromDiscord | <leorize> it might be a codegen issue |
18:17:56 | FromDiscord | <saint._._.> https://forum.nim-lang.org/t/7535 |
18:18:00 | FromDiscord | <saint._._.> From this thread |
18:18:08 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4GnI |
18:18:28 | FromDiscord | <leorize> tbh that sounds like a bug to me |
18:18:36 | FromDiscord | <leorize> you should never have to cast a function pointer |
18:18:42 | FromDiscord | <leorize> if you do it it must be intentional |
18:18:43 | FromDiscord | <saint._._.> Isnt there a diff between like (funcName) (int a, int b) and (funcName) (int a, int b) |
18:19:01 | FromDiscord | <Phil> In reply to @leorize "tbh that sounds like": Ignore that for now, I've got like 5 different places I'm trying to wrap my head around, I'm not looking to add another |
18:19:09 | FromDiscord | <leorize> yes, the former doesn't exist in C↵(@saint._._.) |
18:19:20 | FromDiscord | <Phil> This is from owlkettle and I'm just learning destructor hooks through an "easy" issue there |
18:19:22 | FromDiscord | <leorize> I wasn't talking to you lol↵(@Phil) |
18:19:46 | FromDiscord | <Phil> Ohhh the entire pointer thingy in the hook caught me off guard |
18:20:05 | FromDiscord | <Phil> (edit) "caught" => "made" | "off guard" => "think you wrote to me" |
18:20:07 | FromDiscord | <leorize> no↵(@Phil) |
18:20:19 | FromDiscord | <leorize> the style is dependent on the writer |
18:20:28 | FromDiscord | <leorize> personally I limit guards to very long functions |
18:20:41 | FromDiscord | <saint._._.> In reply to @leorize "yes, the former doesn't": Does it exist in cpp? |
18:20:51 | FromDiscord | <Phil> Alright, wasn't sure if there was some kind of branch thing going on where nesting something in an if-block was better than having a guard at the start |
18:21:11 | FromDiscord | <leorize> not sure↵(@saint._._.) |
18:21:25 | FromDiscord | <leorize> but anyhow, if it passes sem then it's likely a codegen issue |
18:22:03 | FromDiscord | <leorize> most compilers doesn't care about details like that↵(@Phil) |
18:22:13 | FromDiscord | <saint._._.> In reply to @leorize "most compilers doesn't care": Hmm |
18:22:17 | FromDiscord | <Phil> In reply to @leorize "most compilers doesn't care": Sweet! |
18:22:19 | FromDiscord | <saint._._.> I think it's a nim thing though in a sense too |
18:22:26 | FromDiscord | <saint._._.> If I don't cast, I get this |
18:22:26 | FromDiscord | <saint._._.> sent a code paste, see https://paste.rs/NzJbM |
18:22:39 | FromDiscord | <saint._._.> Wait |
18:23:02 | FromDiscord | <saint._._.> Wrong output lol |
18:23:06 | FromDiscord | <saint._._.> If I don't cast, I get this |
18:23:19 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GnL |
18:23:36 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GnM |
18:23:42 | FromDiscord | <saint._._.> It sees my fPtr as pointer |
18:23:45 | FromDiscord | <saint._._.> Which makes sense I guess |
18:23:47 | FromDiscord | <leorize> you shouldn't need fPtr at all |
18:23:52 | FromDiscord | <leorize> that's what I meant |
18:23:55 | FromDiscord | <leorize> you don't need cast |
18:24:00 | FromDiscord | <saint._._.> Just the name |
18:24:01 | FromDiscord | <leorize> and you don't need a variable as indirection |
18:24:02 | FromDiscord | <saint._._.> (edit) "name" => "name?" |
18:24:12 | FromDiscord | <saint._._.> I see why is it done in that thread then |
18:24:15 | FromDiscord | <saint._._.> https://forum.nim-lang.org/t/7535 |
18:24:30 | FromDiscord | <saint._._.> Oh maybe cause its an anon func |
18:24:49 | FromDiscord | <leorize> because that thread is concerned with dlopen() |
18:24:51 | FromDiscord | <saint._._.> Oh right |
18:24:57 | FromDiscord | <saint._._.> Yeah was just gonna say that |
18:25:11 | FromDiscord | <saint._._.> So u think it's a bug? |
18:25:17 | FromDiscord | <saint._._.> I should submit it? |
18:25:25 | FromDiscord | <leorize> what compiler version are you using? |
18:27:38 | FromDiscord | <leorize> test if it still errors if you use the function directly |
18:27:51 | FromDiscord | <leorize> if it does, look at the generated C/C++ file |
18:28:01 | FromDiscord | <leorize> how was that function called? |
18:30:07 | FromDiscord | <leorize> an issue could simply be that the compiler didn't generate an addressing expression for that call |
18:30:11 | FromDiscord | <leorize> in that case it is a codegen bug |
18:31:25 | * | ntat quit (Quit: leaving) |
18:34:37 | FromDiscord | <Chronos [She/Her]> Anyone know if anything exists for signing in pkcs7 and parsing pkcs8? |
18:35:17 | FromDiscord | <saint._._.> In reply to @leorize "what compiler version are": I'm using apple clang 14 |
18:38:25 | FromDiscord | <saint._._.> Ohhhhh |
18:38:29 | FromDiscord | <saint._._.> I was using cpp lol |
18:38:41 | FromDiscord | <leorize> I couldn't repro it with cpp fwiw |
18:38:46 | FromDiscord | <saint._._.> It works just with the function name with c @leorize |
18:38:57 | FromDiscord | <saint._._.> I was workign with another project with nim cpp and I stuck with that haha |
18:43:04 | FromDiscord | <Phil> enthus1ast, enlighten me, how do I tell atlas "Use the repo I have as local package for now"? |
18:43:31 | FromDiscord | <Phil> I want to compile owlkettle examples without having to fumble around in the installed global owlkettle package |
18:53:49 | * | krux02 quit (Remote host closed the connection) |
19:00:05 | FromDiscord | <leorize> you do know you can just... `nim c --path:.. examples/`, right? |
19:01:46 | FromDiscord | <Phil> No because I keep forgetting that path exists |
19:06:17 | FromDiscord | <enthus1ast> @Phil\: you mean like (the old) nimble develop ? |
19:06:54 | FromDiscord | <Phil> In reply to @leorize "you do know you": It turns out that doesn't quite do it though, at least running `~/dev/owlkettle % nim c --path:./owlkettle.nim --run ./examples/widgets/picture.nim` is non functional |
19:07:27 | FromDiscord | <enthus1ast> you can put that what leorize said also into your cfg or nims file |
19:07:57 | FromDiscord | <enthus1ast> but i still hope the old nimble develop comes back \:\| |
19:09:04 | FromDiscord | <leorize> `--path` takes directories↵(@Phil) |
19:11:19 | FromDiscord | <Phil> God dangit the flipping little details, yeah that solved it |
19:12:03 | FromDiscord | <saint._._.> In reply to @leorize "I couldn't repro it": Hmm |
19:12:13 | FromDiscord | <saint._._.> Yeah, even if I use cpp it shouldn't break right |
19:12:16 | FromDiscord | <saint._._.> Maybe I should report it |
19:12:42 | * | disso-peach joined #nim |
19:14:22 | FromDiscord | <leorize> yea, might be a lil hard to make a repro for your case |
19:14:57 | FromDiscord | <saint._._.> True |
19:15:03 | FromDiscord | <leorize> might be a corner case for codegen |
19:15:20 | FromDiscord | <leorize> what does the nim portions related to it looks like? |
19:39:20 | FromDiscord | <saint._._.> In reply to @leorize "what does the nim": What do you mean? |
19:39:56 | FromDiscord | <leorize> the context where you call the function |
19:40:15 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Goi |
19:40:26 | FromDiscord | <saint._._.> printcb is the func, and I call it that way |
19:40:58 | FromDiscord | <saint._._.> Or rather I did it that way with cpp, I'm just passing printcb instead of fPtr now with c |
19:53:03 | * | junaid_ quit (Remote host closed the connection) |
19:54:13 | * | Batzy joined #nim |
20:03:43 | FromDiscord | <leorize> how did you import the procs? |
20:04:18 | FromDiscord | <leorize> the lxb\_ ones |
20:06:02 | FromDiscord | <leorize> and are you using the latest nim compiler? |
20:37:17 | * | advesperacit quit () |
20:40:29 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Goy |
20:49:26 | FromDiscord | <Elegantbeef> You can have destructors for distincts |
20:50:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/tHTCV |
20:51:35 | FromDiscord | <Elegantbeef> Guess I should @Phil just to make sure you see |
20:51:49 | FromDiscord | <kingterrytheterrible12> distinct pointer? what is that |
20:52:04 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#types-distinct-type |
20:52:09 | FromDiscord | <Elegantbeef> This is where I say RTFM |
20:53:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4GoC |
20:53:57 | FromDiscord | <Phil> Because I know I can't do destructors on ref-types |
20:54:35 | FromDiscord | <bananajuice__> Hi. I'm new to Nim. Is there a place where I can get the definitive answer on how C interop is done and what's the overhead ? |
20:54:55 | FromDiscord | <Elegantbeef> There is no overhead |
20:55:03 | FromDiscord | <Elegantbeef> You use the `importc` pragma |
20:55:32 | FromDiscord | <Elegantbeef> A small example of C interop is here https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim |
20:55:52 | FromDiscord | <Phil> In reply to @bananajuice__ "Hi. I'm new to": Note that nim generates C-code, so basically you're just linking generated C-code against compiled C-libs (or against normally written C source code). |
20:55:56 | FromDiscord | <Elegantbeef> This of course compiles the C library that is a git submodule into the nim program to remove any 'build system' |
20:56:48 | FromDiscord | <Phil> (edit) removed "(or against normally written C source code)." |
20:58:07 | FromDiscord | <kingterrytheterrible12> In reply to @bananajuice__ "Hi. I'm new to": you can use futhrak if you like |
20:58:11 | FromDiscord | <kingterrytheterrible12> my pmunch |
20:58:15 | FromDiscord | <kingterrytheterrible12> (edit) "my" => "by" |
20:59:31 | FromDiscord | <kingterrytheterrible12> also @pmunch how in the living hell do you plan to make futhrak work with C++? |
20:59:41 | FromDiscord | <kingterrytheterrible12> the language changes faster than you can parse |
21:00:10 | FromDiscord | <pmunch> I'm not doing the parsing, clang is 😉 |
21:00:36 | FromDiscord | <pmunch> That's the secret of Futhark |
21:00:38 | FromDiscord | <Phil> I'm reasonably sure that every time I heard people talk about wrapping C++ it was "There's so mach lang spec and features and variations to wrap its basically impossible" |
21:00:50 | FromDiscord | <kingterrytheterrible12> In reply to @isofruit "I'm reasonably sure that": yes |
21:01:19 | FromDiscord | <pmunch> It's "just" a layer on top of libclang which converts what it spits out to something Nim can interface with |
21:05:05 | FromDiscord | <kingterrytheterrible12> In reply to @pmunch "It's "just" a layer": "just"? |
21:05:26 | FromDiscord | <pmunch> It still is quite a bit of work.. |
21:06:24 | FromDiscord | <raynei486> C and C++ are so painful to parse that every attempt to do so just ends up with "let's just tell a C/C++ compiler to do it" |
21:07:28 | FromDiscord | <kingterrytheterrible12> In reply to @raynei486 "C and C++ are": xd |
21:25:40 | FromDiscord | <Elegantbeef> I mean that's how it should be |
21:25:53 | FromDiscord | <Elegantbeef> Like you can write a Nim parser but due to templates and macros that doesnt mean much |
21:43:53 | FromDiscord | <saint._._.> In reply to @pmunch "That's the secret of": Oh hey Pmuch I have some questions about futhark, first being I can't get it to install |
21:44:44 | FromDiscord | <saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GoL |
21:44:49 | FromDiscord | <saint._._.> This is for macos |
21:45:10 | FromDiscord | <Elegantbeef> install libclang |
21:46:11 | FromDiscord | <nobody3232_12980> sent a long message, see http://ix.io/4GoM |
21:47:19 | FromDiscord | <saint._._.> In reply to @Elegantbeef "install libclang": Would that be llvm for homebrew |
21:47:39 | FromDiscord | <Elegantbeef> your cpu isnt doing anything when you sleep hence cputime being 0 |
21:47:39 | FromDiscord | <Elegantbeef> `import std/[os, monotimes, times]` and then us `getMonoTime` |
21:48:47 | FromDiscord | <Elegantbeef> Do I look like brew user 😛 |
21:48:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GoN |
21:49:01 | FromDiscord | <saint._._.> In reply to @Elegantbeef "Do I look like": https://cdn.discordapp.com/attachments/713760162460074034/906235599231533056/giggle-emote.png |
21:50:22 | FromDiscord | <nobody3232_12980> sent a code paste, see https://play.nim-lang.org/#ix=4GoO |
22:22:38 | FromDiscord | <millymox> What do you guys recommend for nim GUI development? It’s a fairly simple app im making but it should support tab views, scrollable sections, desgin wise shouldn’t look a ancient and should be cross platform. If nim has some kind of electron like desktop app package then that would be sweet |
22:26:44 | FromDiscord | <raynei486> [figma](https://github.com/treeform/fidget) sounds like a good fit |
22:26:58 | FromDiscord | <raynei486> (edit) "[figma](https://github.com/treeform/fidget)" => "[fidget](https://github.com/treeform/fidget)" |
22:34:14 | FromDiscord | <kingterrytheterrible12> are empty strings considered null? |
22:34:26 | FromDiscord | <kingterrytheterrible12> sent a code paste, see https://play.nim-lang.org/#ix=4GoW |
22:34:38 | FromDiscord | <kingterrytheterrible12> assuming `folderName` was `""` will checking if its null work? |
22:53:19 | FromDiscord | <millymox> In reply to @raynei486 "[fidget](https://github.com/treeform/fidget) sounds": Looks good I’ll give it a try! |
22:56:18 | FromDiscord | <kingterrytheterrible12> In reply to @millymox "What do you guys": nimqml |
22:59:53 | FromDiscord | <raynei486> In reply to @kingterrytheterrible12 "are empty strings considered": why not just `if folderName == ""` |
23:00:09 | FromDiscord | <kingterrytheterrible12> In reply to @raynei486 "why not just `if": welp thats what happened xd |
23:00:26 | FromDiscord | <kingterrytheterrible12> and also how do imports work in nim? |
23:01:04 | FromDiscord | <raynei486> as in how modules get compiled and stuff? |
23:02:20 | FromDiscord | <kingterrytheterrible12> In reply to @raynei486 "as in how modules": as in how do i import a proc |
23:02:49 | FromDiscord | <raynei486> `from module import proc` |
23:03:25 | FromDiscord | <kingterrytheterrible12> In reply to @raynei486 "`from module import proc`": ty |
23:03:30 | FromDiscord | <raynei486> i.e. `from std/strutils import parseInt` |
23:09:08 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Gp8 |
23:09:50 | FromDiscord | <sOkam! 🫐> (edit) "https://play.nim-lang.org/#ix=4Gp8" => "https://play.nim-lang.org/#ix=4Gp9" |
23:11:39 | FromDiscord | <takemichihanagaki3129> What is the best way to debug a sigsegv in Nim? |
23:12:24 | FromDiscord | <sOkam! 🫐> In reply to @takemichihanagaki3129 "What is the best": did you try `nim-gdb yourapp` compiling with `--debugger:native`? |
23:13:04 | FromDiscord | <sOkam! 🫐> this guide also explains some of it:↵https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#debugging-nim-code |
23:13:43 | FromDiscord | <kingterrytheterrible12> In reply to @takemichihanagaki3129 "What is the best": segfault? |
23:13:44 | FromDiscord | <kingterrytheterrible12> gg |
23:13:45 | * | tinystoat quit (Server closed connection) |
23:13:50 | FromDiscord | <kingterrytheterrible12> sent a code paste, see https://play.nim-lang.org/#ix=4Gpb |
23:13:54 | * | tinystoat joined #nim |
23:15:08 | FromDiscord | <kingterrytheterrible12> also why does my nim app have poor performance? |
23:15:26 | FromDiscord | <sOkam! 🫐> did you compile with -d:release? |
23:15:31 | FromDiscord | <kingterrytheterrible12> In reply to @heysokam "did you compile with": No |
23:15:37 | FromDiscord | <kingterrytheterrible12> debug |
23:15:46 | FromDiscord | <kingterrytheterrible12> + valgrind attached |
23:15:54 | FromDiscord | <sOkam! 🫐> lol then no wonder its slow |
23:16:39 | FromDiscord | <sOkam! 🫐> -d:release gave my rendering exercises a 10x or even 30x increase in speed by changing to release |
23:17:25 | FromDiscord | <kingterrytheterrible12> yeah compiling with release and LTO gave me a huge speed boost |
23:17:28 | FromDiscord | <kingterrytheterrible12> like night and day |
23:17:30 | FromDiscord | <kingterrytheterrible12> lol |
23:17:32 | FromDiscord | <sOkam! 🫐> yeah |
23:19:19 | FromDiscord | <kingterrytheterrible12> also anyone here on zsh that can test my program? |
23:20:06 | FromDiscord | <takemichihanagaki3129> In reply to @heysokam "did you try `nim-gdb": Thanks for the tip, I'll try it. |
23:20:22 | FromDiscord | <takemichihanagaki3129> In reply to @kingterrytheterrible12 "segfault?": Yes, this! |
23:20:59 | FromDiscord | <kingterrytheterrible12> yay merge conflicts |
23:21:01 | FromDiscord | <kingterrytheterrible12> damn it |
23:22:35 | * | lucasta_ joined #nim |
23:29:38 | FromDiscord | <millymox> Best database package or nim? Should be a local database, perhaps key value pair |
23:29:43 | FromDiscord | <millymox> Like SQLite |
23:30:03 | FromDiscord | <kingterrytheterrible12> In reply to @millymox "Best database package or": sqlite |
23:30:03 | FromDiscord | <sOkam! 🫐> In reply to @millymox "Best database package or": `db_connector` |
23:30:22 | FromDiscord | <sOkam! 🫐> it has backends for all three SQL databases, using the exact same syntax |
23:30:42 | FromDiscord | <sOkam! 🫐> it used to be `std/db_connector` but now they are separate packages |
23:34:15 | FromDiscord | <millymox> In reply to @heysokam "it used to be": src/db_connector/db_sqlite? |
23:34:31 | FromDiscord | <millymox> Just took a lot at it, very straight forward thank you for the recommendation! |
23:35:42 | FromDiscord | <kingterrytheterrible12> where to get visual debugger for nim |
23:36:13 | FromDiscord | <sOkam! 🫐> In reply to @kingterrytheterrible12 "where to get visual": get a gdb visual frontend and run it with nim-gdb |
23:36:59 | FromDiscord | <kingterrytheterrible12> nim-gdb? |
23:37:01 | FromDiscord | <sOkam! 🫐> i've used `gdbfrontend` and `nakst/gf` in the past, both useful |
23:37:02 | FromDiscord | <kingterrytheterrible12> why not regular gdb |
23:37:15 | FromDiscord | <sOkam! 🫐> In reply to @kingterrytheterrible12 "why not regular gdb": because regular does not understand nim symbols/code |
23:37:21 | FromDiscord | <kingterrytheterrible12> bet |
23:37:22 | FromDiscord | <sOkam! 🫐> so you step through the C code, not the nim code |
23:39:42 | FromDiscord | <millymox> Stupid question: i have a file folder that has a proc, would like to use it in my main file, how do i do that lol https://media.discordapp.net/attachments/371759389889003532/1152025914482376754/IMG_4937.png |
23:40:09 | FromDiscord | <kingterrytheterrible12> sent a code paste, see https://play.nim-lang.org/#ix=4Gpe |
23:40:45 | FromDiscord | <sOkam! 🫐> In reply to @millymox "Stupid question: i have": `import ./storage/myfile` |
23:41:20 | FromDiscord | <sOkam! 🫐> oh sorry. `import ./crypto/encryption` |
23:41:51 | FromDiscord | <sOkam! 🫐> actually, no your code is correct too |
23:42:16 | FromDiscord | <millymox> My code is correct? Hm |
23:42:17 | FromDiscord | <sOkam! 🫐> that might be nimlsp not updating. try to compile before trusting the hints/errors |
23:42:25 | NimEventer | New thread by KerryC: Conditional use of procs when a type stastfies requirements of a concept, see https://forum.nim-lang.org/t/10483 |
23:43:16 | FromDiscord | <millymox> In reply to @heysokam "that might be nimlsp": Alr thanks let me try |
23:43:43 | FromDiscord | <millymox> Nope doesn’t work, says encrypt() is an undeclared identifieer |
23:44:00 | FromDiscord | <millymox> My function, that’s all it is https://media.discordapp.net/attachments/371759389889003532/1152026997418107000/IMG_4939.png |
23:44:02 | FromDiscord | <sOkam! 🫐> In reply to @millymox "Nope doesn’t work, says": did you `` the encrypt proc? |
23:44:13 | FromDiscord | <sOkam! 🫐> yeah there is the probl. you need to export the function |
23:44:29 | FromDiscord | <sOkam! 🫐> `proc encrypt(str:string) = ...` |
23:44:42 | FromDiscord | <millymox> Ah okay i see yeah I didn’t know was exporting, thanks! |
23:44:45 | FromDiscord | <sOkam! 🫐> in nim all symbols are private by default, you make them public by marking them with `` |
23:45:47 | FromDiscord | <millymox> In reply to @heysokam "in nim all symbols": Thank you, it worked! |
23:47:56 | FromDiscord | <kingterrytheterrible12> sent a code paste, see https://play.nim-lang.org/#ix=4Gpf |
23:47:57 | FromDiscord | <kingterrytheterrible12> something is seriously fucked here |
23:48:29 | FromDiscord | <kingterrytheterrible12> in the try except i keep getting `pathToEnvFile declared but not used` |
23:48:35 | FromDiscord | <kingterrytheterrible12> when i am using it clearly |
23:48:59 | FromDiscord | <kingterrytheterrible12> bruh |
23:49:01 | FromDiscord | <kingterrytheterrible12> nvm |
23:53:21 | FromDiscord | <sOkam! 🫐> you can make `folderName` a `:var string` if you need to modify it |
23:53:54 | FromDiscord | <sOkam! 🫐> if its only temporary, I would personally give it a different name. something like `tmpFolderName` or similar, so its not confusing by shadowing the symbol |
23:54:32 | FromDiscord | <sOkam! 🫐> shadowing is super bad when the app grows into something other than an isolated function |
23:55:20 | FromDiscord | <sOkam! 🫐> too easy to skimread and think you understood, but actually didn't, and not find the actual bug because the symbol was shadowed locally |
23:57:30 | FromDiscord | <kingterrytheterrible12> In reply to @heysokam "you can make `folderName`": it would work? |
23:58:24 | FromDiscord | <kingterrytheterrible12> it actually does |
23:58:27 | FromDiscord | <kingterrytheterrible12> thanks! |
23:58:51 | FromDiscord | <kingterrytheterrible12> you can reivew the whole damn thing here btw↵https://github.com/FaisalAhmedAlghamdi/libre-pathadder/tree/unstable |
23:59:20 | FromDiscord | <sOkam! 🫐> In reply to @kingterrytheterrible12 "it would work?": yes, but it would modify the source directly. if that's something you cannot afford, then you need the local temp variable |
23:59:38 | FromDiscord | <kingterrytheterrible12> modify it how |