<< 14-09-2023 >>

00:14:33*azimut quit (Ping timeout: 246 seconds)
00:26:55FromDiscord<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:11FromDiscord<odexine> Compile flags?
00:28:23FromDiscord<breadpudding> sent a code paste, see https://play.nim-lang.org/#ix=4Gjd
00:32:28FromDiscord<odexine> I think that OS should say standalone instead of any
00:32:36FromDiscord<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:37FromDiscord<odexine> Not sure exactly though
00:32:57FromDiscord<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:21FromDiscord<breadpudding> Here's the old arguments: https://github.com/cbpudding/mapledos/blob/main/kernel/mapledos.nim.cfg
00:34:13FromDiscord<breadpudding> sent a code paste, see https://play.nim-lang.org/#ix=4Gjf
00:36:33FromDiscord<odexine> I don’t see that file it references in the repo?
00:37:53FromDiscord<breadpudding> Just committed my unfinished code
00:41:34FromDiscord<odexine> I have bets that it’s related to your massive arrays
00:41:49FromDiscord<odexine> Not sure what causes it exactly aside from that though
00:41:50FromDiscord<breadpudding> Probably...
00:42:57*genr8eofl__ is now known as genr8eofl
00:44:55FromDiscord<breadpudding> Still dies when I delete my entire LUT
00:45:48FromDiscord<odexine> Seems like a libc is needed
00:45:55FromDiscord<odexine> In any case
00:47:27FromDiscord<nervecenter> sent a long message, see http://ix.io/4Gjg
00:47:36FromDiscord<nervecenter> (edit) "http://ix.io/4Gjg" => "http://ix.io/4Gjh"
00:48:31FromDiscord<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:48FromDiscord<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:56FromDiscord<nervecenter> (edit) "tradeoff" => "tradeoff,"
00:49:17FromDiscord<breadpudding> As someone who used to program in Rust, that's one of the reasons why I'm moving away from it.
00:49:34FromDiscord<odexine> In reply to @breadpudding "Actually, something interesting... I": What do you mean?
00:49:42FromDiscord<odexine> Did I skip a message by mistake
00:49:45FromDiscord<breadpudding> Same error on `nim` 1.6.10
00:50:48FromDiscord<breadpudding> Aaaaand switching back to my distro's packaged Nim causes the same error
00:50:57FromDiscord<breadpudding> Now I'm confused about how I got it to build in the first place
00:53:56FromDiscord<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:08FromDiscord<nervecenter> (edit) "ML-life" => "ML-like functional"
00:54:29FromDiscord<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:42FromDiscord<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:06FromDiscord<Elegantbeef> `-d:useMalloc`?↵(@breadpudding)
02:02:10FromDiscord<Elegantbeef> Or am I daft
02:02:25FromDiscord<breadpudding> I don't think you can use `malloc` if it doesn't exist.
02:02:33FromDiscord<Elegantbeef> You can use malloc then override it to your implementation
02:02:39FromDiscord<breadpudding> True...
02:02:54FromDiscord<Elegantbeef> https://github.com/Yardanico/mimalloc_nim is an example doing that with mimalloc
02:03:09FromDiscord<Elegantbeef> Of course you would use your own allocator, but same difference
02:04:14FromDiscord<Elegantbeef> For the time being you could make the allocation procs no ops
02:31:43FromDiscord<Haze System (they/them)> sent a code paste, see https://play.nim-lang.org/#ix=4GjC
02:32:55FromDiscord<Elegantbeef> Like i said you cannot do runtime indexing with tuples
02:33:06FromDiscord<Haze System (they/them)> ohhh
02:33:18FromDiscord<Haze System (they/them)> didnt know what that meant at the time
02:34:22FromDiscord<leorize> see if `-fstack-check` is in gcc&#x27;s command line↵(@breadpudding)
02:34:53FromDiscord<leorize> pass `-fno-stack-check` to disable that feature
02:44:30FromDiscord<breadpudding> I ended up reverting a commit to fix the issue
02:44:37FromDiscord<breadpudding> I'll keep that in mind for the future
02:58:39FromDiscord<Haze System (they/them)> sent a code paste, see https://play.nim-lang.org/#ix=4GjH
02:58:44FromDiscord<Elegantbeef> `mobs.mitems`
02:58:52FromDiscord<Haze System (they/them)> ahh right, thank you
03:34:30FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=
03:34:50FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=
03:35:20FromDiscord<Elegantbeef> Holy shit we're still on this
03:35:58FromDiscord<Elegantbeef> Actually sorry, this is not command syntax but block syntax
03:36:00FromDiscord<Elegantbeef> So you get a pass
03:36:19FromDiscord<ravinder387> it was add 1,2 this is different
03:36:49FromDiscord<ravinder387> https://media.discordapp.net/attachments/371759389889003532/1151723195104243763/Screenshot_2023-09-14_090613.png
03:37:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GjM
03:38:20FromDiscord<Langosta> sent a code paste, see https://play.nim-lang.org/#ix=4GjN
03:38:53FromDiscord<Elegantbeef> The code works even without the space
03:39:11FromDiscord<Langosta> hmm
03:41:03FromDiscord<ravinder387> it works.. nim's syntax is very interesting
03:41:31FromDiscord<Elegantbeef> It's not nearly interesting enough to spend months starring at a single slide
03:41:57FromDiscord<Langosta> Honestly, I would be careful about using too much sugar. You'll get cavities
03:42:30FromDiscord<Langosta> but also, It's not like I'm uber experienced, so take me with a dose of salt
03:42:39FromDiscord<Elegantbeef> It's not even really syntax sugar just alternative syntax
03:44:33FromDiscord<odexine> In reply to @alendrik "but also, It's not": Too much salt is bad for you too though
03:48:49FromDiscord<ravinder387> In reply to @Elegantbeef "It's not nearly interesting": it takes me to understand almost 7 month
03:51:20FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4GjW
03:52:39FromDiscord<ravinder387> sent a code paste, see https://play.nim-lang.org/#ix=4GjX
03:53:01FromDiscord<ravinder387> template is also a function
03:53:37FromDiscord<ravinder387> repeat and statement is arguments of template
04:41:20FromDiscord<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:25FromDiscord<Phil> Thus my bad, I apologize
04:55:18*ntat joined #nim
05:01:12*junaid_ joined #nim
05:47:42FromDiscord<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:46PMunchOoh link?
07:03:44FromDiscord<xtrayambak> https://survey.stackoverflow.co/2023/
07:08:14PMunch"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:43FromDiscord<gogolxdong666> https://media.discordapp.net/attachments/371759389889003532/1151776526954676234/ft.nim
07:09:24FromDiscord<gogolxdong666> Anyone helps to see why it leaks memory so bad?
07:09:36PMunchUhm, why does it import modules more than once?
07:10:19PMunchHave you tried passing it through Valgrind?
07:10:19FromDiscord<Elegantbeef> Can never be too certain
07:10:27PMunch`import json; import json; import json goddamnit!`
07:11:15FromDiscord<gogolxdong666> sorry🥲
07:12:10FromDiscord<Elegantbeef> I'll write an RFC for `nowReallyImport`
07:12:30FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Gkx
07:12:43FromDiscord<sOkam! 🫐> My first idea is the `new ObjectType` in there, but... 🤷‍♂️
07:13:24FromDiscord<gogolxdong666> let's focus on the memory issue.
07:15:50FromDiscord<Elegantbeef> Sokam sounds like accidentally using UB
07:16:13FromDiscord<sOkam! 🫐> what part of it could be causing it?
07:16:44FromDiscord<Elegantbeef> Due to strict aliasing i'm always weary of `cast[ptr T](x.addr)`
07:18:53PMunchAgain, if you are looking for memory leaks, ask Valgrind..
07:19:05FromDiscord<sOkam! 🫐> ah i see. yeah but the chained behavior works like that. what's the alternative to that cast?
07:19:14PMunchIt will tell you what memory is leaking, and where it was allocated
07:19:27FromDiscord<Elegantbeef> compile with `-d:useMalloc --debugger:native` when using valgrind
07:19:42PMunch`nim c --debugger:native -d:useMalloc myproject.nim; valgrind --leak-check=full ./myproject`
07:19:48FromDiscord<Elegantbeef> I mean there isnt an alternative
07:19:54FromDiscord<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:16FromDiscord<Elegantbeef> well descriptor is a stack object and you're returning an address to it
07:20:39FromDiscord<sOkam! 🫐> isn't it allocated by doing `new` though?
07:20:54FromDiscord<Elegantbeef> So then you do not want to do `descriptor. addr`
07:20:59FromDiscord<Elegantbeef> you want to just cast the ref to a pointer
07:21:32FromDiscord<Elegantbeef> `new` heap allocates making a `ref T`
07:21:41FromDiscord<Elegantbeef> Atleast if you're using the builtin new
07:21:41PMunchI wonder what the sample size on this is: "Zig is the highest-paid language to know this year (a new addition)"
07:21:54FromDiscord<sOkam! 🫐> so it would be `cast[ptr ChainedStruct](descriptor)` instead?
07:21:57FromDiscord<Elegantbeef> There are like 10 zig devs
07:22:01FromDiscord<nnsee> In reply to @PMunch "I wonder what the": at least 2
07:22:01FromDiscord<Elegantbeef> I kid of course
07:22:04FromDiscord<Elegantbeef> Yes
07:22:11FromDiscord<sOkam! 🫐> i will try
07:22:11*xmachina quit (Ping timeout: 252 seconds)
07:22:41*xmachina joined #nim
07:22:46PMunchBut 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:51FromDiscord<nnsee> In reply to @PMunch ""Why complicate it? Jira": what did you migrate to?
07:22:53FromDiscord<Elegantbeef> You were casting a pointer to the stack instead of the pointer to the heap
07:23:03FromDiscord<Elegantbeef> Insert "wait you're getting paid" meme here
07:23:31FromDiscord<nnsee> treeform is getting paid pretty big bucks to write nim at reddit i believe
07:23:36PMunchnnsee, 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:10FromDiscord<sOkam! 🫐> you are a wizard, beef
07:24:18PMunchI mean I also primarily write Nim, and I get paid quite handsomely, but the two aren't really correlated :P
07:24:18FromDiscord<sOkam! 🫐> that worked, tysm (as per usual)
07:24:21FromDiscord<Elegantbeef> You are a wizard harry
07:24:58FromDiscord<Elegantbeef> I should start shaking a cup outside
07:25:39FromDiscord<nnsee> In reply to @PMunch "I mean I also": same, and I'm not even a developer of any kind
07:25:39FromDiscord<sOkam! 🫐> now I wonder how that even worked on gcc
07:26:02FromDiscord<Elegantbeef> You got lucky the stack was valid
07:26:25FromDiscord<sOkam! 🫐> i guess so
07:26:35PMunchElegantbeef, 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:15FromDiscord<Elegantbeef> Well I do nothing really
07:27:59PMunchNothing?
07:28:55FromDiscord<Elegantbeef> Yes
07:29:17FromDiscord<sOkam! 🫐> I'm curious too. Are you retired, or something like that?
07:29:43FromDiscord<Elegantbeef> I refer to myself as a pretend caregiver
07:30:03FromDiscord<xtrayambak> In reply to @gogolxdong666 "": don't exceptions leak memory or smt?
07:30:06PMunchPretend?
07:30:09FromDiscord<xtrayambak> I think I saw an issue on the issue tracker
07:30:11FromDiscord<xtrayambak> about this
07:30:24FromDiscord<xtrayambak> it was labelled gamestopper but it's still open
07:30:33PMunchYup: https://github.com/nim-lang/Nim/issues/22672
07:30:44FromDiscord<Elegantbeef> Yea I don't get paid, i'm unemployed and help my disabled parents
07:30:53PMunchTo be fair that one is only about a week old
07:30:58FromDiscord<xtrayambak> In reply to @Elegantbeef "Yea I don't get": that's hard
07:31:02FromDiscord<sOkam! 🫐> ah gotcha
07:31:07FromDiscord<Elegantbeef> Eh it's not
07:31:29FromDiscord<xtrayambak> how do ya get money if you're unemployed?
07:31:32PMunchElegantbeef, ah that's not great, but good on you for taking care of them
07:31:56FromDiscord<sOkam! 🫐> In reply to @xtrayambak "how do ya get": sounds like family mutual support
07:32:15FromDiscord<xtrayambak> it's nice that you take care of them
07:32:38FromDiscord<xtrayambak> I've seen a lot of people who just abandon their parents when they're not paid
07:32:43FromDiscord<xtrayambak> atleast in India
07:34:04FromDiscord<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:12FromDiscord<xtrayambak> I'm pretty sure Nitter also leaks memory if you set the GC to ARC
07:35:36PMunchWell that's fairly normal, there's bound to be some issues
07:36:17PMunchI'm curious how many projects will stop leaking when this exception stuff is patched
07:37:51PMunchNeat, Nim made the list of programming languages. We have a measly 0.40% though, but still!
07:40:30FromDiscord<xtrayambak> the year of the nim programming language is nearing
07:40:42FromDiscord<xtrayambak> hopefully we don't become the linux of programming languages xD
07:41:41FromDiscord<xtrayambak> btw, does anyone work full time on Nim, or is everyone a hobbyist?
07:41:46FromDiscord<xtrayambak> I'm curious to know xd
07:42:21PMunchOn Nim as in making the language? There are a couple people on the payroll, yes
07:42:24Amun-RaI'm not even a professional programmer
07:43:48FromDiscord<xtrayambak> In reply to @PMunch "On Nim as in": Ah, I thought it was a bunch of hobbyists lol
07:45:21FromDiscord<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:59Amun-Rasince when junior programmers have anything to say in the matter? ;)
07:47:00PMunchThe trick is to just start using it for small internal stuff, then slowly but surely bring it on to bigger projects
07:47:17Amun-Ra^ this
07:49:53FromDiscord<xtrayambak> In reply to @Amun-Ra "since when junior programmers": I'll probably join a startup, then
07:49:59FromDiscord<xtrayambak> sounds stupid but that'll probably work
07:50:23FromDiscord<xtrayambak> unless the person running the startup is a starbucks loving mac fanboy who swears by JavaScript
07:50:36FromDiscord<xtrayambak> In reply to @PMunch "The trick is to": this sounds less insane though
07:52:30Amun-Ranever go full, erm, insane
07:54:11FromDiscord<xtrayambak> I have a patent on being insane
07:54:17FromDiscord<xtrayambak> don't ya try to snatch that from me
07:54:49FromDiscord<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:53FromDiscord<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:31FromDiscord<odexine> but why
08:33:34FromDiscord<odexine> nim has lua bindings
09:04:56PMunch*insert glory of satan meme*
09:05:33PMunchI swear I reference this meme too much in real life, pretty sure some people think I'm an actual Satanist..
09:17:06FromDiscord<Phil> You're not? I've been lied to?
09:17:11FromDiscord<Phil> (edit) "to?" => "to!"
09:19:15FromDiscord<frobnicate> In reply to @xtrayambak "btw, does anyone work": Hobby
09:28:07FromDiscord<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:42FromDiscord<enthus1ast> The trick is to be the only real it guy and just use it everywhere
10:14:19FromDiscord<okabintaro> sent a long message, see http://ix.io/4Gl7
10:14:52FromDiscord<okabintaro> (edit) "http://ix.io/4Gl7" => "http://ix.io/4Gl8"
10:14:56FromDiscord<Phil> PMunch!↵I would like to have your opinion on this one!
10:15:04FromDiscord<Phil> Its regarding destructors with owlkettle
10:20:01FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Gl9
10:20:40FromDiscord<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:41PMunchWhat would you catch?
10:27:01PMunchg_object_unref wouldn't raise any Nim exception
10:27:05PMunchSo it would never catch anything
10:27:43FromDiscord<Phil> Do exceptions raised in C not get passed on to nim somehow? Like a Db always raises DbError?
10:28:14PMunchWhich exceptions? C doesn't have exceptions..
10:28:44FromDiscord<Phil> Err.... fair point, given that I have not written any C code I keep subconsciously assuming it does
10:29:55PMunchOh, and by the way. Why do you have `PixBuf = ref PixbufObj`?
10:30:16PMunchYour PixbufObj holds a pointer, so it's already kind of a reference type
10:31:28PMunchIn 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:58FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Glc
10:32:29FromDiscord<Phil> The code originally used a "finalizer" which did work with ref-types
10:32:39FromDiscord<Phil> (edit) "The code originally used a "finalizer" ... which" added "(previous iteration of destructors?)"
10:33:14PMunchThat'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:37PMunchYeah finalizers became destructors I believe
10:35:10PMunchI'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:04FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Gle
10:36:42FromDiscord<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:29FromDiscord<Phil> Though at a glance it doesn't seem like that breaks things
10:40:06PMunchHmm, might be good to keep it as a reference object..
10:43:01PMunchSome more research on this topic is required I think. But yeah, just keep it as a reference object for now
10:45:34FromDiscord<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:50FromDiscord<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:43PMunch_Sorry I lost connection there for a sec
10:54:58PMunch_Last I saw was the "I'll point it out in the owlkettle issue" comment
10:55:13FromDiscord<Phil> Yeh didn't type anything else in the meantime
11:13:07FromDiscord<toma400> sent a code paste, see https://play.nim-lang.org/#ix=4Glk
11:13:33FromDiscord<toma400> sent a code paste, see https://play.nim-lang.org/#ix=4Gll
11:15:24PMunch_Well..
11:15:27PMunch_Not like that
11:17:57PMunch_This would work, where it not for the two swords: https://play.nim-lang.org/#ix=4Glm
11:18:48PMunch_This works: https://play.nim-lang.org/#ix=4Glo
11:19:59PMunch_You could of course create a neater system for this
11:21:17FromDiscord<toma400> What `shl` stands for?
11:21:25PMunch_Shift left
11:24:00FromDiscord<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:04FromDiscord<toma400> (edit) "Thank you. I'm not entirely ... on" added "sure"
11:24:28PMunch_Pretty much, yes
11:24:42PMunch_Enums can only hold integers and/or strings
11:25:16PMunch_They get an int value implicitly, and the string value would just be the stringification of their identifier by default
11:25:40PMunch_But you can do `EnumVal = (1, "First")` to set the int and string explicitly
11:25:52PMunch_What this does is basically create a bitmap
11:27:14PMunch_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:00PMunch_So with a normal 64-bit int you would only be able to store 64 different things this way
11:31:50PMunch_You could of course get jiggy with it: https://play.nim-lang.org/#ix=4Glq
11:33:27PMunch_Or you could consider doing a lookup table
11:34:12PMunch_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:20PMunchtoma400 ^
11:42:01FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4Glt
11:44:14PMunchLook like an ORC bug
11:45:23FromDiscord<enthus1ast> what exactly does the acyclic pragma?
11:50:34PMunchThe acyclic pragma does
11:51:25PMunchJust kidding, it tells Nim that a reference can't create a cycle, so there is no need for ORC to scan it
11:51:57PMunchIn 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:23FromDiscord<enthus1ast> so they should be annotated
11:55:24FromDiscord<enthus1ast> ?
11:55:33FromDiscord<enthus1ast> but its missing in the current version
11:59:18PMunchAh but they have cursor
11:59:36PMunchWait, that wouldn't help though..
11:59:39FromDiscord<toma400> sent a code paste, see https://play.nim-lang.org/#ix=4Glw
12:00:35PMunchUhm, that would be quite expensive..
12:00:44FromDiscord<toma400> (edit) "https://play.nim-lang.org/#ix=4Glw" => "https://play.nim-lang.org/#ix=4Gly"
12:00:51FromDiscord<toma400> (edit) "https://play.nim-lang.org/#ix=4Gly" => "https://play.nim-lang.org/#ix=4Glz"
12:01:00FromDiscord<toma400> (edit) "https://play.nim-lang.org/#ix=4Glz" => "https://play.nim-lang.org/#ix=4GlA"
12:01:03PMunchCreating a small table like that and checking if something is contained within it is a very Pythonic way of doing it :P
12:02:11FromDiscord<toma400> Can't fight my origin xP↵I will try to learn proper Nim one day, I promise 😅
12:02:48FromDiscord<enthus1ast> This is also a rather mystery to me↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
12:04:16FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4GlB
12:04:25FromDiscord<enthus1ast> then the table is created on compile time
12:06:15PMunchI 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:03FromDiscord<enthus1ast> i also did some experiments with a "perfect hash function" searcher
12:07:04PMunchAnd the keys would be densely packed unlike a Table, so memory footprint should be lower
12:07:14PMunchPerfect hash function searcher?
12:07:38FromDiscord<enthus1ast> a perfect hash function is a hash function (for a given input) that does not generate collisions
12:07:47FromDiscord<enthus1ast> and is very fast
12:08:01PMunchRight
12:09:51FromDiscord<enthus1ast> mhh i forgot the name of the hash function...
12:09:55FromDiscord<enthus1ast> one sec
12:10:04FromDiscord<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:10FromDiscord<Chronos [She/Her]> To guarantee uniqueness?
12:10:30FromDiscord<enthus1ast> only for a given input
12:10:38FromDiscord<enthus1ast> so eg you know all the keys beforehand
12:10:54FromDiscord<enthus1ast> then you can find a hash function that never create collisions for the given set of keys
12:11:24FromDiscord<Nelson> imagen.png https://media.discordapp.net/attachments/371759389889003532/1151852698191265872/imagen.png
12:12:07FromDiscord<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:07PMunchUhm, `1 >> 1`?
12:12:09FromDiscord<toma400> Thank you!
12:12:17FromDiscord<toma400> (edit) ":o" => ":o↵Thank you!"
12:12:37PMunch`const` "variables" can use procs, the procs just have to be compile-time :P
12:12:38FromDiscord<Nelson> what would be the right way to do something like this in Nim?
12:12:39FromDiscord<Nelson> Like, an enum where every value maps out to bits in an integer
12:12:58FromDiscord<toma400> In reply to @PMunch "`const` "variables" can use": True ^^
12:12:59PMunchNelson, scroll up a bit, we just discussed this actually :)
12:13:31PMunchNelson, something along these lines: https://play.nim-lang.org/#ix=4Glo
12:13:41PMunchBut they are right shifting, which is a bit suspect
12:14:37PMunchThe 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:40FromDiscord<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:54FromDiscord<enthus1ast> this can be done in an automatic fashion
12:17:37FromDiscord<Nelson> Ha!↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
12:17:51FromDiscord<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:52FromDiscord<Nelson> whoops, did not sleep well yesterday lol↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
12:18:06PMunchOh, that's your code :P
12:18:09FromDiscord<Nelson> valid, makes sense↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
12:18:12PMunchI thought you where porting something :)
12:18:22FromDiscord<Nelson> oh that's interesting
12:18:32FromDiscord<Nelson> nim uses shl
12:18:42*blop_ quit (Ping timeout: 246 seconds)
12:18:54PMunchOf 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:05FromDiscord<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:11FromDiscord<Nelson> thanks!↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
12:19:55*blop_ joined #nim
12:27:55FromDiscord<Chronos [She/Her]> I'm half tempted to do something with the library I made for handling (basic) MC packets
12:29:30FromDiscord<Chronos [She/Her]> Though I want to work on something else...just not sure what
12:29:59FromDiscord<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:21FromDiscord<toma400> It'd be at least interesting to have them so flexible
12:30:27FromDiscord<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:45PMunchtoma400, 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:35FromDiscord<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:32FromDiscord<Chronos [She/Her]> Fuck it, I'm gonna just use Futhark to save myself the headache
12:45:13FromDiscord<Chronos [She/Her]> This is odd- Clang is installed on my system but ld can't find it
12:45:29FromDiscord<Chronos [She/Her]> Oh wait maybe bc I'm cmpiling with gcc
12:46:25PMunchYou can still use Futhark with GCC
12:46:54PMunchI mean Futhark uses clang and Opir requires libclang, but you can compile your Futhark'd wrapper with Gcc
12:47:47FromDiscord<Chronos [She/Her]> Hm then yeah idk why the linker can't find clang
12:48:09FromDiscord<Chronos [She/Her]> When installing Futhark: `/usr/bin/ld: cannot find -lclang: No such file or directory`
12:48:15PMunchAre you on Ubuntu?
12:48:29PMunchIt installs libclang in some crazy folder out of the search tree
12:48:35*junaid_ joined #nim
12:48:50FromDiscord<Chronos [She/Her]> On an Archlinux distro, used pacman t install it
12:49:06FromDiscord<Chronos [She/Her]> There's no folder for libclang in /usr/include tho so
12:51:35PMunchHmm, strange
12:51:45FromDiscord<Chronos [She/Her]> Yeaah
12:51:50*ntat joined #nim
12:51:58PMunch`pacman -Ql clang | grep libclang.so`
12:53:06FromDiscord<Chronos [She/Her]> ..ah you know what's strange? :p
12:53:14FromDiscord<Chronos [She/Her]> I ran pacman install and it didn't install-
12:53:29FromDiscord<Chronos [She/Her]> Wait what
12:53:33FromDiscord<Chronos [She/Her]> It says it's installed
12:53:41FromDiscord<Chronos [She/Her]> But it's not even on path?
12:55:11FromDiscord<Chronos [She/Her]> Okay well I just installed `clang` instead of `clang15` and it works so-
12:55:25FromDiscord<Chronos [She/Her]> Futhark now works lol
12:55:46PMunchNice
12:58:38FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4GlT
12:59:52PMunchYou shouldn't, as long as you have the header you should be good
13:00:05PMunchAnd you shouldn't have to pass `sysPath`, it should be automatically detected
13:01:21PMunchIs it possible to run one test with Nimble?
13:01:53FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4GlW
13:01:56FromDiscord<Chronos [She/Her]> In reply to @PMunch "Is it possible to": I could, sure
13:02:16PMunchChronos_[She/Her], that question wasn't really for you :P
13:02:31PMunchI meant if there is a way to run just one of the tests in a Nimble package
13:02:37FromDiscord<Chronos [She/Her]> Ah sorry-
13:02:57PMunchWhere is `speaklib.h` located?
13:03:20FromDiscord<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:53FromDiscord<Chronos [She/Her]> Nvm nope
13:04:19FromDiscord<Chronos [She/Her]> I tried that but yeah I put the one that would've been ran first anyway lol
13:04:30FromDiscord<Chronos [She/Her]> `/usr/include/espeak-ng`
13:04:33PMunchHaha, yeah I can't get it to work
13:04:37FromDiscord<Chronos [She/Her]> That's where speaklib is found
13:04:42FromDiscord<Chronos [She/Her]> In reply to @PMunch "Haha, yeah I can't": Sorry :p
13:05:30PMunchI believe `path "/usr/include/espeak-ng"` and then just `"speaklib.h"` should work
13:05:52FromDiscord<Chronos [She/Her]> That's what I'm doing now but no dice
13:06:00PMunchOh wait, maybe it has to be `espeak-ng/speaklib.h`
13:06:08FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4GlY
13:06:11FromDiscord<Chronos [She/Her]> In reply to @PMunch "Oh wait, maybe it": Also tried that before too
13:07:14PMunchThat's because it's called speak_lib.h...
13:07:34PMunchIt helps to use the correct filenames ;)
13:07:52PMunchThis compiles for me: http://ix.io/4Gm1
13:08:07FromDiscord<Chronos [She/Her]> ... 🤦‍♀️ sorry about thataha
13:08:27FromDiscord<Chronos [She/Her]> I suffer from chronically stupid :p
13:08:44FromDiscord<Chronos [She/Her]> That indeed works now aha
13:08:58FromDiscord<ravinder387> No worry I forgive you
13:09:19PMunchHaha, no worries. Good to know I was actually correct and Futhark did indeed work as expected
13:09:27PMunchEy, you forgive him?
13:10:46FromDiscord<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:32FromDiscord<Phil> How in the everliving hell did I completely blank on the official docs having edit buttons
13:42:44PMunchHaha, I know!
13:48:16FromDiscord<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:50FromDiscord<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:07FromDiscord<Phil> (edit) "read" => "fetch"
13:51:44FromDiscord<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:15PMunchNothing really, apart from AsyncFD having been opened with the non-blocking flag
13:52:19FromDiscord<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:17FromDiscord<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:46PMunchNot sure what you mean
13:55:16PMunchIf you've gotten as AsyncFD the file is created, otherwise the OS wouldn't give you a file descriptor
13:55:22PMunchI believe
13:55:57FromDiscord<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:04FromDiscord<Phil> (edit) "happy.↵I" => "different.↵I"
13:56:37PMunchI'm not sure I follow what you mean..
13:56:43FromDiscord<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:04FromDiscord<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:23FromDiscord<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:03PMunchYeah, 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:19PMunchNote: On Linux everything is a file, so a socket could also be a file
14:00:01FromDiscord<Phil> Is there a normal "FileDescriptor"-type?
14:04:11FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Gmk
14:04:21FromDiscord<Phil> Yes
14:04:40FromDiscord<Phil> Keep in mind even the nimble file is in the end kinda just nimscript with a few extras
14:05:14FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Gml
14:06:06FromDiscord<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:13FromDiscord<Chronos [She/Her]> Great!
14:06:20FromDiscord<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:19FromDiscord<leorize> unless you're on windows
14:26:10NimEventerNew 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:56FromDiscord<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:06FromDiscord<Phil> Time to make a lot of tiny doc comment PRs
15:10:07*krux02 joined #nim
15:16:23arkanoidevery version update, I spend more time fighting vscode working with nim than writing actual code
15:17:03arkanoidI have my project building and tests passing at command line, but vscode shows 254 errors
15:17:43FromDiscord<.grimrippa> I'm trying out nimx, on windows but it says sdl2.dll cannot be found?
15:22:23FromDiscord<.grimrippa> got it to work by getting sdl2 in the directory containing the exe
15:29:48FromDiscord<_gumbercules> that's how shared libraries on Windows work
15:31:23FromDiscord<_gumbercules> gotta have the shared library (dll) in the linker's search path
15:32:51arkanoidfound the culprit, is not vscode, but nim itself. nim c project.nim succeeds, nim check project.nim tons of errors
15:40:33arkanoidgot it, it is due to how nim c and nimble looks for deps, and the pkgs vs pkgs2 thing
15:42:03arkanoidso 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:59arkanoidso 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:28arkanoidsolved by wiping conflicting libs in pkgs folder
15:50:23arkanoidthe strategy used by nimble and nim to search for deps should be 1:1, otherwise these thing will happen a lot
15:50:59FromDiscord<xtrayambak> In reply to @odexine "nim has lua bindings": I didn't know nimble.directory or `nimble search` existed
15:50:59FromDiscord<xtrayambak> lol
15:53:54*ox is now known as oz
15:56:33FromDiscord<odexine> oh rip
16:04:09FromDiscord<taperfade> In reply to @m4ul3r "Winim is just a": where can i learn
16:04:14FromDiscord<taperfade> abt it
16:07:28FromDiscord<raynei486> https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-api-list
16:09:11FromDiscord<taperfade> wtf
16:09:20FromDiscord<taperfade> theres so much
16:11:21FromDiscord<raynei486> well it's the whole index
16:11:32FromDiscord<taperfade> idk what i need to read
16:11:36FromDiscord<taperfade> theres so
16:11:39FromDiscord<taperfade> much
16:11:42FromDiscord<raynei486> maybe better place to start
16:11:43FromDiscord<raynei486> https://learn.microsoft.com/en-us/windows/win32/
16:11:45FromDiscord<leorize> just look for some win32 gui guide or something
16:11:45FromDiscord<m4ul3r> Windows is massive, but pretty much the windows internals good is a good start for windows system programming
16:12:15FromDiscord<taperfade> all code examples are in c
16:12:21FromDiscord<taperfade> 😔
16:12:45FromDiscord<raynei486> time to learn C 😛
16:12:50FromDiscord<taperfade> nope
16:12:58FromDiscord<taperfade> not interested
16:13:15FromDiscord<raynei486> honestly very okay if you're interested in knowing what things are really like
16:13:22FromDiscord<raynei486> helps you appreciate high level stuff
16:13:39FromDiscord<leorize> if you use winim the API you use is C API
16:13:47FromDiscord<raynei486> also the world and every library runs on C (terrible)
16:14:49FromDiscord<m4ul3r> Just translate it to nim. The winim wrapper wraps c 🤷‍♂️
16:15:13FromDiscord<raynei486> yeah
16:16:20FromDiscord<taperfade> also
16:16:21FromDiscord<taperfade> https://media.discordapp.net/attachments/371759389889003532/1151914341646467163/image.png
16:16:32FromDiscord<taperfade> c compiler refuses to work
16:16:37FromDiscord<taperfade> didnt work in linux too
16:17:33FromDiscord<taperfade> i lost all my motivation to code
16:17:36FromDiscord<taperfade> literally
16:17:38FromDiscord<taperfade> in this minute
16:19:23FromDiscord<raynei486> your mingw installation might be borked
16:19:28FromDiscord<raynei486> how did it not work in Linux?
16:19:33FromDiscord<taperfade> idk
16:19:37FromDiscord<taperfade> wait ill boot linux
16:20:16FromDiscord<taperfade> i must be a masochist
16:20:22FromDiscord<taperfade> using linux
16:20:24FromDiscord<taperfade> yuck
16:20:26FromDiscord<raynei486> programming is masochistic lol
16:20:32FromDiscord<raynei486> if you make it that wat
16:20:35FromDiscord<raynei486> (edit) "wat" => "way"
16:20:40FromDiscord<taperfade> spits on the floor
16:20:47FromDiscord<taperfade> ok brb
16:22:42FromDiscord<raynei486> what distro are you using?
16:23:31FromDiscord<taperfade> debian
16:23:56FromDiscord<taperfade> i hate how it looks https://media.discordapp.net/attachments/371759389889003532/1151916250008662036/image.png
16:24:03FromDiscord<taperfade> i tried so hard to make it look decent
16:24:40FromDiscord<raynei486> you can install a distro that looks good by default wat
16:25:46FromDiscord<taperfade> wdym
16:25:53FromDiscord<taperfade> all of them look ass
16:25:54FromDiscord<taperfade> lmao
16:25:58FromDiscord<leorize> head to r/unixporn and make your pick
16:30:14FromDiscord<taperfade> nvm got it to work on linux
16:30:28FromDiscord<taperfade> In reply to @leorize "head to r/unixporn and": no
16:30:34FromDiscord<taperfade> i need a reason to hate on linux ppl
16:30:53FromDiscord<taperfade> also win11 needs no "ricing" to look amazing
16:31:13FromDiscord<taperfade> 🤷🏼‍♀️
16:33:15FromDiscord<leorize> sounds like you already know what to use
16:33:22*jmdaemon joined #nim
16:49:27FromDiscord<kingterrytheterrible12> i think im just gonna switch to debian
16:59:38FromDiscord<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:41arkanoidfrobnicate, 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:15FromDiscord<odexine> that's why i recommend not to use nimble 0.14;)
17:01:17FromDiscord<odexine> (edit) "0.14;)" => "0.14 😉"
17:01:30FromDiscord<frobnicate> Hmm?
17:01:51FromDiscord<frobnicate> You don't need choosenim if you're in a container?
17:02:12FromDiscord<kingterrytheterrible12> In reply to @odexine "that's why i recommend": what happen to kanon
17:03:44arkanoidwell, 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:22FromDiscord<enthus1ast> sent a code paste, see https://paste.rs/cqu7V
17:04:29FromDiscord<enthus1ast> so if one wants to test feel free \:)
17:05:24FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4Gne
17:05:25FromDiscord<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:17FromDiscord<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:42FromDiscord<frobnicate> This is why dev containers are practical
17:10:16FromDiscord<taperfade> guys
17:10:21FromDiscord<taperfade> idk what to do
17:11:01FromDiscord<leorize> what do you want to do?
17:17:32FromDiscord<taperfade> idk
17:17:39FromDiscord<saint._._.> Does anyone know how to pass a callback into C code from nim?
17:17:57FromDiscord<leorize> make a callback and attach `{.cdecl.}` to it↵(@saint._._.)
17:17:58FromDiscord<taperfade> malicious software but u guys dont like talking abt that
17:18:01FromDiscord<leorize> then just pass its name
17:18:04FromDiscord<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:09FromDiscord<leorize> you can't use any closure feature
17:18:18FromDiscord<saint._._.> @leorize I'm doing that but I'm getting a type mismatch
17:18:35FromDiscord<leorize> then you'll need to post the message here
17:18:50FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Gnh
17:18:53FromDiscord<_gumbercules> In reply to @taperfade "malicious software but u": go make your own server to talk about it in then
17:19:01FromDiscord<_gumbercules> be the change you want to see in the world
17:19:02FromDiscord<saint._._.> So it's expecting a type of `lexbor_serialize_cb_f`
17:19:15FromDiscord<saint._._.> `type lexbor_serialize_cb_f {.importc.} = proc (data: ptr lxb_char_t, len: cint, ctx: pointer ): cint {.cdecl.}↵`
17:19:17FromDiscord<griffith1deadly> In reply to @_gumbercules "be the change you": and get ban from discord
17:19:20FromDiscord<saint._._.> This is the import
17:19:22FromDiscord<_gumbercules> that's not on me
17:19:27FromDiscord<saint._._.> `proc printcb (data: ptr lxb_char_t, len: int, ctx: pointer): cint {.cdecl.} =↵`
17:19:31FromDiscord<saint._._.> And that is my nim function
17:19:39FromDiscord<saint._._.> It has the same function params
17:19:40FromDiscord<leorize> `int` -\@saint._._.)
17:20:05FromDiscord<saint._._.> Ohh
17:20:08FromDiscord<griffith1deadly> int are int64, cint = int32
17:20:08FromDiscord<saint._._.> That fixed something
17:20:12FromDiscord<saint._._.> Gotcha
17:20:22FromDiscord<saint._._.> Thank u so much already
17:20:33FromDiscord<saint._._.> Back in the days on irc if you asked a question like that they would first ask you
17:20:37FromDiscord<saint._._.> "What are you trying to do"
17:20:42FromDiscord<saint._._.> And then again what are you really trying to do
17:20:45FromDiscord<saint._._.> Are you sure you need callbacks
17:20:53FromDiscord<saint._._.> And son
17:21:00FromDiscord<saint._._.> (edit) "son" => "so on"
17:21:04FromDiscord<saint._._.> 😆
17:21:43arkanoidfrobnicate: which language server are you talking about?
17:22:15arkanoidbtw, I'm interested in testing out the container. Is it free/open source?
17:22:24FromDiscord<griffith1deadly> https://github.com/nim-lang/langserver
17:22:26FromDiscord<griffith1deadly> maybe this?
17:29:24arkanoidI'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:18FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Gnl
17:31:36FromDiscord<saint._._.> Is it an issue with unsigned char to const unsigned char ?
17:31:40FromDiscord<taperfade> <:GO_catStanding:1133402101205192734>
17:31:53FromDiscord<saint._._.> Why is the type unsigned int ()
17:31:59FromDiscord<saint._._.> I'm not familiar with that
17:32:02FromDiscord<taperfade> Im so lost
17:32:11FromDiscord<taperfade> Idk what to work on
17:32:23FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Gnn
17:32:27FromDiscord<saint._._.> This is the typedef of the callback in C
17:32:39FromDiscord<saint._._.> lxb_status_t is just an int
17:32:41FromDiscord<saint._._.> int enum
17:32:54FromDiscord<saint._._.> unsigned int
17:33:15FromDiscord<leorize> what's the nim prototype for it?
17:33:42FromDiscord<saint._._.> `type lexbor_serialize_cb_f {.importc.} = proc (data: ptr lxb_char_t, len: csize_t, ctx: pointer ): cint {.cdecl.}↵`
17:34:05FromDiscord<saint._._.> And this is the actual proc I'm passing
17:34:05FromDiscord<saint._._.> `proc printcb (data: ptr lxb_char_t, len: csize_t, ctx: pointer): cint {.cdecl.} =↵`
17:34:17FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Gno
17:34:47FromDiscord<leorize> because it's not needed under the sink invariant
17:35:22FromDiscord<Phil> Assume I know nothing about nothing because I actually don't.↵What is the sink invariant?
17:36:14FromDiscord<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:20FromDiscord<leorize> the sink idea is that data go in and the origin is gone
17:42:21FromDiscord<leorize> you can never access the origin again
17:42:22FromDiscord<leorize> so yes, it's "magic"
17:42:28FromDiscord<leorize> basically a protocol where we all agree that it will never be accessed again
17:43:00FromDiscord<leorize> implementation wise, Nim emit a wasMoved() for the source anyways because that makes destructors simpler
17:43:37FromDiscord<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:47FromDiscord<Phil> (edit) "access," => "access and getting destroyed,"
17:43:47FromDiscord<leorize> yes
17:43:53FromDiscord<leorize> I mean, look at the sink prototype
17:44:02FromDiscord<leorize> you /can't/ edit the source even if you wanted to
17:44:12FromDiscord<Phil> Ah, fair
17:46:27FromDiscord<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:28FromDiscord<saint._._.> @leorize Any idea about my callback problem?
17:49:24FromDiscord<leorize> try cuint for the return value
17:49:25FromDiscord<leorize> this is definitely not making a lot of sense hmm
17:49:27FromDiscord<leorize> how do you call this function in nim?
17:50:20FromDiscord<griffith1deadly> In reply to @leorize "try cuint for the": yep, compiler says that lexbor_serialize_cb_f (return type) is uint
17:50:33FromDiscord<griffith1deadly> (edit) "uint" => "uint, not int"
17:50:41FromDiscord<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:09FromDiscord<saint._._.> In reply to @leorize "try cuint for the": Oh does cuint make a dif
17:51:10FromDiscord<saint._._.> Maybe
17:51:20FromDiscord<saint._._.> `typedef lxb_status_t↵(lexbor_serialize_cb_f)(const lxb_char_t data, size_t len, void ctx);↵`
17:51:30FromDiscord<saint._._.> I thought this was the issue that it's a pointer to the function
17:51:47FromDiscord<saint._._.> Idk if that makes a dif or not
17:52:38FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Gnv
17:52:42FromDiscord<saint._._.> Changed to cuint and got this
17:52:45FromDiscord<saint._._.> I thin kit's the pointer thing
17:52:51FromDiscord<saint._._.> (edit) "thin kit's" => "think it's"
17:53:18FromDiscord<frobnicate> In reply to @arkanoid "I've heard polarized opinions": No it doesn't? It works fine for me
17:53:36FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=4Gnw
17:53:54FromDiscord<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:18FromDiscord<leorize> all function types are pointers fwiw
17:54:35arkanoidfrobnicate, no hurry. I'm alien to dev containers, so this would be the icebreaker
17:54:38FromDiscord<frobnicate> https://github.com/AFaurholt/nim-sdl2-cross/blob/main/.devcontainer/Dockerfile
17:55:04FromDiscord<frobnicate> Just add glibc before you start adding the lang server
17:58:13FromDiscord<frobnicate> Then you can run it with the dev container extension for vscode
17:58:48FromDiscord<frobnicate> Just tag the image as nim_sdl:latest or whatever I called it in the .devcontaier
18:00:46FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4GnA
18:01:49FromDiscord<saint._._.> https://forum.nim-lang.org/t/7640
18:01:53FromDiscord<saint._._.> I'm following basically this
18:05:34FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GnC
18:05:41FromDiscord<saint._._.> Because right now I am not including the header file for my import for this specifically
18:05:53FromDiscord<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:54FromDiscord<saint._._.> yo I got it to work
18:16:07FromDiscord<saint._._.> I was passing the function pointer in wrong, I was just including the function name
18:16:12FromDiscord<leorize> https://play.nim-lang.org/#ix=4GnG \<- testing here shows clear result
18:16:13FromDiscord<leorize> so not sure what's wrong with yours
18:16:35FromDiscord<leorize> but that's... how you do it?
18:16:59FromDiscord<Phil> Actually, another question, are guard clauses somehow regarded as bad?
18:17:04FromDiscord<Phil> (edit) "bad?" => "bad style?"
18:17:21FromDiscord<saint._._.> I think that's cause u aren't using this c lib @leorize
18:17:31FromDiscord<saint._._.> I had to cast the function pointer
18:17:45FromDiscord<leorize> I'm pretty much using the same C as that lib
18:17:47FromDiscord<leorize> so...
18:17:49FromDiscord<saint._._.> Thats how I got it to work
18:17:49FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GnH
18:17:50FromDiscord<leorize> it might be a codegen issue
18:17:56FromDiscord<saint._._.> https://forum.nim-lang.org/t/7535
18:18:00FromDiscord<saint._._.> From this thread
18:18:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4GnI
18:18:28FromDiscord<leorize> tbh that sounds like a bug to me
18:18:36FromDiscord<leorize> you should never have to cast a function pointer
18:18:42FromDiscord<leorize> if you do it it must be intentional
18:18:43FromDiscord<saint._._.> Isnt there a diff between like (funcName) (int a, int b) and (funcName) (int a, int b)
18:19:01FromDiscord<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:09FromDiscord<leorize> yes, the former doesn't exist in C↵(@saint._._.)
18:19:20FromDiscord<Phil> This is from owlkettle and I'm just learning destructor hooks through an "easy" issue there
18:19:22FromDiscord<leorize> I wasn't talking to you lol↵(@Phil)
18:19:46FromDiscord<Phil> Ohhh the entire pointer thingy in the hook caught me off guard
18:20:05FromDiscord<Phil> (edit) "caught" => "made" | "off guard" => "think you wrote to me"
18:20:07FromDiscord<leorize> no↵(@Phil)
18:20:19FromDiscord<leorize> the style is dependent on the writer
18:20:28FromDiscord<leorize> personally I limit guards to very long functions
18:20:41FromDiscord<saint._._.> In reply to @leorize "yes, the former doesn't": Does it exist in cpp?
18:20:51FromDiscord<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:11FromDiscord<leorize> not sure↵(@saint._._.)
18:21:25FromDiscord<leorize> but anyhow, if it passes sem then it's likely a codegen issue
18:22:03FromDiscord<leorize> most compilers doesn't care about details like that↵(@Phil)
18:22:13FromDiscord<saint._._.> In reply to @leorize "most compilers doesn't care": Hmm
18:22:17FromDiscord<Phil> In reply to @leorize "most compilers doesn't care": Sweet!
18:22:19FromDiscord<saint._._.> I think it's a nim thing though in a sense too
18:22:26FromDiscord<saint._._.> If I don't cast, I get this
18:22:26FromDiscord<saint._._.> sent a code paste, see https://paste.rs/NzJbM
18:22:39FromDiscord<saint._._.> Wait
18:23:02FromDiscord<saint._._.> Wrong output lol
18:23:06FromDiscord<saint._._.> If I don't cast, I get this
18:23:19FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GnL
18:23:36FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GnM
18:23:42FromDiscord<saint._._.> It sees my fPtr as pointer
18:23:45FromDiscord<saint._._.> Which makes sense I guess
18:23:47FromDiscord<leorize> you shouldn't need fPtr at all
18:23:52FromDiscord<leorize> that's what I meant
18:23:55FromDiscord<leorize> you don't need cast
18:24:00FromDiscord<saint._._.> Just the name
18:24:01FromDiscord<leorize> and you don't need a variable as indirection
18:24:02FromDiscord<saint._._.> (edit) "name" => "name?"
18:24:12FromDiscord<saint._._.> I see why is it done in that thread then
18:24:15FromDiscord<saint._._.> https://forum.nim-lang.org/t/7535
18:24:30FromDiscord<saint._._.> Oh maybe cause its an anon func
18:24:49FromDiscord<leorize> because that thread is concerned with dlopen()
18:24:51FromDiscord<saint._._.> Oh right
18:24:57FromDiscord<saint._._.> Yeah was just gonna say that
18:25:11FromDiscord<saint._._.> So u think it's a bug?
18:25:17FromDiscord<saint._._.> I should submit it?
18:25:25FromDiscord<leorize> what compiler version are you using?
18:27:38FromDiscord<leorize> test if it still errors if you use the function directly
18:27:51FromDiscord<leorize> if it does, look at the generated C/C++ file
18:28:01FromDiscord<leorize> how was that function called?
18:30:07FromDiscord<leorize> an issue could simply be that the compiler didn't generate an addressing expression for that call
18:30:11FromDiscord<leorize> in that case it is a codegen bug
18:31:25*ntat quit (Quit: leaving)
18:34:37FromDiscord<Chronos [She/Her]> Anyone know if anything exists for signing in pkcs7 and parsing pkcs8?
18:35:17FromDiscord<saint._._.> In reply to @leorize "what compiler version are": I'm using apple clang 14
18:38:25FromDiscord<saint._._.> Ohhhhh
18:38:29FromDiscord<saint._._.> I was using cpp lol
18:38:41FromDiscord<leorize> I couldn't repro it with cpp fwiw
18:38:46FromDiscord<saint._._.> It works just with the function name with c @leorize
18:38:57FromDiscord<saint._._.> I was workign with another project with nim cpp and I stuck with that haha
18:43:04FromDiscord<Phil> enthus1ast, enlighten me, how do I tell atlas "Use the repo I have as local package for now"?
18:43:31FromDiscord<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:05FromDiscord<leorize> you do know you can just... `nim c --path:.. examples/`, right?
19:01:46FromDiscord<Phil> No because I keep forgetting that path exists
19:06:17FromDiscord<enthus1ast> @Phil\: you mean like (the old) nimble develop ?
19:06:54FromDiscord<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:27FromDiscord<enthus1ast> you can put that what leorize said also into your cfg or nims file
19:07:57FromDiscord<enthus1ast> but i still hope the old nimble develop comes back \:\|
19:09:04FromDiscord<leorize> `--path` takes directories↵(@Phil)
19:11:19FromDiscord<Phil> God dangit the flipping little details, yeah that solved it
19:12:03FromDiscord<saint._._.> In reply to @leorize "I couldn't repro it": Hmm
19:12:13FromDiscord<saint._._.> Yeah, even if I use cpp it shouldn't break right
19:12:16FromDiscord<saint._._.> Maybe I should report it
19:12:42*disso-peach joined #nim
19:14:22FromDiscord<leorize> yea, might be a lil hard to make a repro for your case
19:14:57FromDiscord<saint._._.> True
19:15:03FromDiscord<leorize> might be a corner case for codegen
19:15:20FromDiscord<leorize> what does the nim portions related to it looks like?
19:39:20FromDiscord<saint._._.> In reply to @leorize "what does the nim": What do you mean?
19:39:56FromDiscord<leorize> the context where you call the function
19:40:15FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4Goi
19:40:26FromDiscord<saint._._.> printcb is the func, and I call it that way
19:40:58FromDiscord<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:43FromDiscord<leorize> how did you import the procs?
20:04:18FromDiscord<leorize> the lxb\_ ones
20:06:02FromDiscord<leorize> and are you using the latest nim compiler?
20:37:17*advesperacit quit ()
20:40:29FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Goy
20:49:26FromDiscord<Elegantbeef> You can have destructors for distincts
20:50:04FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/tHTCV
20:51:35FromDiscord<Elegantbeef> Guess I should @Phil just to make sure you see
20:51:49FromDiscord<kingterrytheterrible12> distinct pointer? what is that
20:52:04FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#types-distinct-type
20:52:09FromDiscord<Elegantbeef> This is where I say RTFM
20:53:44FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4GoC
20:53:57FromDiscord<Phil> Because I know I can't do destructors on ref-types
20:54:35FromDiscord<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:55FromDiscord<Elegantbeef> There is no overhead
20:55:03FromDiscord<Elegantbeef> You use the `importc` pragma
20:55:32FromDiscord<Elegantbeef> A small example of C interop is here https://github.com/beef331/wasm3/blob/master/src/wasm3/wasm3c.nim
20:55:52FromDiscord<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:56FromDiscord<Elegantbeef> This of course compiles the C library that is a git submodule into the nim program to remove any 'build system'
20:56:48FromDiscord<Phil> (edit) removed "(or against normally written C source code)."
20:58:07FromDiscord<kingterrytheterrible12> In reply to @bananajuice__ "Hi. I'm new to": you can use futhrak if you like
20:58:11FromDiscord<kingterrytheterrible12> my pmunch
20:58:15FromDiscord<kingterrytheterrible12> (edit) "my" => "by"
20:59:31FromDiscord<kingterrytheterrible12> also @pmunch how in the living hell do you plan to make futhrak work with C++?
20:59:41FromDiscord<kingterrytheterrible12> the language changes faster than you can parse
21:00:10FromDiscord<pmunch> I'm not doing the parsing, clang is 😉
21:00:36FromDiscord<pmunch> That's the secret of Futhark
21:00:38FromDiscord<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:50FromDiscord<kingterrytheterrible12> In reply to @isofruit "I'm reasonably sure that": yes
21:01:19FromDiscord<pmunch> It's "just" a layer on top of libclang which converts what it spits out to something Nim can interface with
21:05:05FromDiscord<kingterrytheterrible12> In reply to @pmunch "It's "just" a layer": "just"?
21:05:26FromDiscord<pmunch> It still is quite a bit of work..
21:06:24FromDiscord<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:28FromDiscord<kingterrytheterrible12> In reply to @raynei486 "C and C++ are": xd
21:25:40FromDiscord<Elegantbeef> I mean that's how it should be
21:25:53FromDiscord<Elegantbeef> Like you can write a Nim parser but due to templates and macros that doesnt mean much
21:43:53FromDiscord<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:44FromDiscord<saint._._.> sent a code paste, see https://play.nim-lang.org/#ix=4GoL
21:44:49FromDiscord<saint._._.> This is for macos
21:45:10FromDiscord<Elegantbeef> install libclang
21:46:11FromDiscord<nobody3232_12980> sent a long message, see http://ix.io/4GoM
21:47:19FromDiscord<saint._._.> In reply to @Elegantbeef "install libclang": Would that be llvm for homebrew
21:47:39FromDiscord<Elegantbeef> your cpu isnt doing anything when you sleep hence cputime being 0
21:47:39FromDiscord<Elegantbeef> `import std/[os, monotimes, times]` and then us `getMonoTime`
21:48:47FromDiscord<Elegantbeef> Do I look like brew user 😛
21:48:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4GoN
21:49:01FromDiscord<saint._._.> In reply to @Elegantbeef "Do I look like": https://cdn.discordapp.com/attachments/713760162460074034/906235599231533056/giggle-emote.png
21:50:22FromDiscord<nobody3232_12980> sent a code paste, see https://play.nim-lang.org/#ix=4GoO
22:22:38FromDiscord<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:44FromDiscord<raynei486> [figma](https://github.com/treeform/fidget) sounds like a good fit
22:26:58FromDiscord<raynei486> (edit) "[figma](https://github.com/treeform/fidget)" => "[fidget](https://github.com/treeform/fidget)"
22:34:14FromDiscord<kingterrytheterrible12> are empty strings considered null?
22:34:26FromDiscord<kingterrytheterrible12> sent a code paste, see https://play.nim-lang.org/#ix=4GoW
22:34:38FromDiscord<kingterrytheterrible12> assuming `folderName` was `""` will checking if its null work?
22:53:19FromDiscord<millymox> In reply to @raynei486 "[fidget](https://github.com/treeform/fidget) sounds": Looks good I’ll give it a try!
22:56:18FromDiscord<kingterrytheterrible12> In reply to @millymox "What do you guys": nimqml
22:59:53FromDiscord<raynei486> In reply to @kingterrytheterrible12 "are empty strings considered": why not just `if folderName == ""`
23:00:09FromDiscord<kingterrytheterrible12> In reply to @raynei486 "why not just `if": welp thats what happened xd
23:00:26FromDiscord<kingterrytheterrible12> and also how do imports work in nim?
23:01:04FromDiscord<raynei486> as in how modules get compiled and stuff?
23:02:20FromDiscord<kingterrytheterrible12> In reply to @raynei486 "as in how modules": as in how do i import a proc
23:02:49FromDiscord<raynei486> `from module import proc`
23:03:25FromDiscord<kingterrytheterrible12> In reply to @raynei486 "`from module import proc`": ty
23:03:30FromDiscord<raynei486> i.e. `from std/strutils import parseInt`
23:09:08FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=4Gp8
23:09:50FromDiscord<sOkam! 🫐> (edit) "https://play.nim-lang.org/#ix=4Gp8" => "https://play.nim-lang.org/#ix=4Gp9"
23:11:39FromDiscord<takemichihanagaki3129> What is the best way to debug a sigsegv in Nim?
23:12:24FromDiscord<sOkam! 🫐> In reply to @takemichihanagaki3129 "What is the best": did you try `nim-gdb yourapp` compiling with `--debugger:native`?
23:13:04FromDiscord<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:43FromDiscord<kingterrytheterrible12> In reply to @takemichihanagaki3129 "What is the best": segfault?
23:13:44FromDiscord<kingterrytheterrible12> gg
23:13:45*tinystoat quit (Server closed connection)
23:13:50FromDiscord<kingterrytheterrible12> sent a code paste, see https://play.nim-lang.org/#ix=4Gpb
23:13:54*tinystoat joined #nim
23:15:08FromDiscord<kingterrytheterrible12> also why does my nim app have poor performance?
23:15:26FromDiscord<sOkam! 🫐> did you compile with -d:release?
23:15:31FromDiscord<kingterrytheterrible12> In reply to @heysokam "did you compile with": No
23:15:37FromDiscord<kingterrytheterrible12> debug
23:15:46FromDiscord<kingterrytheterrible12> + valgrind attached
23:15:54FromDiscord<sOkam! 🫐> lol then no wonder its slow
23:16:39FromDiscord<sOkam! 🫐> -d:release gave my rendering exercises a 10x or even 30x increase in speed by changing to release
23:17:25FromDiscord<kingterrytheterrible12> yeah compiling with release and LTO gave me a huge speed boost
23:17:28FromDiscord<kingterrytheterrible12> like night and day
23:17:30FromDiscord<kingterrytheterrible12> lol
23:17:32FromDiscord<sOkam! 🫐> yeah
23:19:19FromDiscord<kingterrytheterrible12> also anyone here on zsh that can test my program?
23:20:06FromDiscord<takemichihanagaki3129> In reply to @heysokam "did you try `nim-gdb": Thanks for the tip, I'll try it.
23:20:22FromDiscord<takemichihanagaki3129> In reply to @kingterrytheterrible12 "segfault?": Yes, this!
23:20:59FromDiscord<kingterrytheterrible12> yay merge conflicts
23:21:01FromDiscord<kingterrytheterrible12> damn it
23:22:35*lucasta_ joined #nim
23:29:38FromDiscord<millymox> Best database package or nim? Should be a local database, perhaps key value pair
23:29:43FromDiscord<millymox> Like SQLite
23:30:03FromDiscord<kingterrytheterrible12> In reply to @millymox "Best database package or": sqlite
23:30:03FromDiscord<sOkam! 🫐> In reply to @millymox "Best database package or": `db_connector`
23:30:22FromDiscord<sOkam! 🫐> it has backends for all three SQL databases, using the exact same syntax
23:30:42FromDiscord<sOkam! 🫐> it used to be `std/db_connector` but now they are separate packages
23:34:15FromDiscord<millymox> In reply to @heysokam "it used to be": src/db_connector/db_sqlite?
23:34:31FromDiscord<millymox> Just took a lot at it, very straight forward thank you for the recommendation!
23:35:42FromDiscord<kingterrytheterrible12> where to get visual debugger for nim
23:36:13FromDiscord<sOkam! 🫐> In reply to @kingterrytheterrible12 "where to get visual": get a gdb visual frontend and run it with nim-gdb
23:36:59FromDiscord<kingterrytheterrible12> nim-gdb?
23:37:01FromDiscord<sOkam! 🫐> i've used `gdbfrontend` and `nakst/gf` in the past, both useful
23:37:02FromDiscord<kingterrytheterrible12> why not regular gdb
23:37:15FromDiscord<sOkam! 🫐> In reply to @kingterrytheterrible12 "why not regular gdb": because regular does not understand nim symbols/code
23:37:21FromDiscord<kingterrytheterrible12> bet
23:37:22FromDiscord<sOkam! 🫐> so you step through the C code, not the nim code
23:39:42FromDiscord<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:09FromDiscord<kingterrytheterrible12> sent a code paste, see https://play.nim-lang.org/#ix=4Gpe
23:40:45FromDiscord<sOkam! 🫐> In reply to @millymox "Stupid question: i have": `import ./storage/myfile`
23:41:20FromDiscord<sOkam! 🫐> oh sorry. `import ./crypto/encryption`
23:41:51FromDiscord<sOkam! 🫐> actually, no your code is correct too
23:42:16FromDiscord<millymox> My code is correct? Hm
23:42:17FromDiscord<sOkam! 🫐> that might be nimlsp not updating. try to compile before trusting the hints/errors
23:42:25NimEventerNew 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:16FromDiscord<millymox> In reply to @heysokam "that might be nimlsp": Alr thanks let me try
23:43:43FromDiscord<millymox> Nope doesn’t work, says encrypt() is an undeclared identifieer
23:44:00FromDiscord<millymox> My function, that’s all it is https://media.discordapp.net/attachments/371759389889003532/1152026997418107000/IMG_4939.png
23:44:02FromDiscord<sOkam! 🫐> In reply to @millymox "Nope doesn’t work, says": did you `` the encrypt proc?
23:44:13FromDiscord<sOkam! 🫐> yeah there is the probl. you need to export the function
23:44:29FromDiscord<sOkam! 🫐> `proc encrypt(str:string) = ...`
23:44:42FromDiscord<millymox> Ah okay i see yeah I didn’t know was exporting, thanks!
23:44:45FromDiscord<sOkam! 🫐> in nim all symbols are private by default, you make them public by marking them with ``
23:45:47FromDiscord<millymox> In reply to @heysokam "in nim all symbols": Thank you, it worked!
23:47:56FromDiscord<kingterrytheterrible12> sent a code paste, see https://play.nim-lang.org/#ix=4Gpf
23:47:57FromDiscord<kingterrytheterrible12> something is seriously fucked here
23:48:29FromDiscord<kingterrytheterrible12> in the try except i keep getting `pathToEnvFile declared but not used`
23:48:35FromDiscord<kingterrytheterrible12> when i am using it clearly
23:48:59FromDiscord<kingterrytheterrible12> bruh
23:49:01FromDiscord<kingterrytheterrible12> nvm
23:53:21FromDiscord<sOkam! 🫐> you can make `folderName` a `:var string` if you need to modify it
23:53:54FromDiscord<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:32FromDiscord<sOkam! 🫐> shadowing is super bad when the app grows into something other than an isolated function
23:55:20FromDiscord<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:30FromDiscord<kingterrytheterrible12> In reply to @heysokam "you can make `folderName`": it would work?
23:58:24FromDiscord<kingterrytheterrible12> it actually does
23:58:27FromDiscord<kingterrytheterrible12> thanks!
23:58:51FromDiscord<kingterrytheterrible12> you can reivew the whole damn thing here btw↵https://github.com/FaisalAhmedAlghamdi/libre-pathadder/tree/unstable
23:59:20FromDiscord<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:38FromDiscord<kingterrytheterrible12> modify it how