<< 25-05-2025 >>

00:05:08*GnuYawk1 quit (Quit: The Lounge - https://thelounge.chat)
00:06:45*GnuYawk1 joined #nim
00:23:06*GnuYawk1 quit (Quit: The Lounge - https://thelounge.chat)
00:24:26*GnuYawk1 joined #nim
00:40:27*skippy8 quit (Quit: WeeChat 4.5.2)
01:10:19FromDiscord<Robyn [She/Her]> Anyone know if it's possible to make an iterator like `fieldPairs` on types using a macro? I want the `for x, y in typ.fieldPairs: ...` syntax↵↵Usecase is that I wanna make a `variantPairs` macro for grabbing the fields depending on a variant, specifically
03:40:52FromDiscord<DetermiedNim1> hello
03:40:55FromDiscord<DetermiedNim1> quick question
03:41:05FromDiscord<DetermiedNim1> i have this code right https://media.discordapp.net/attachments/371759389889003532/1376042361561550858/image.png?ex=6833e2d0&is=68329150&hm=739b935f93bf06aa0e93357eb5f5c778aa3f68bdbdbb2f31da86b76e44328f60&
03:41:46FromDiscord<DetermiedNim1> when compiling with `nim c --app:lib -d:useMalloc --mm:orc main.nim` only sayHi gets exported
03:42:12FromDiscord<DetermiedNim1> (that command is ripped straight out of a random forum post i found so idk if its fully right or not)
03:42:39FromDiscord<DetermiedNim1> i'm checking with `nm libmain.so`
03:43:51FromDiscord<Elegantbeef> `myRange` is a generic so of course it will not be exposed
03:44:57FromDiscord<janakali> `static` only possible at compile time (nim compile time), you can't expose it in C
03:46:31FromDiscord<DetermiedNim1> ohhhh ok
03:46:34FromDiscord<DetermiedNim1> makes sense
03:46:40FromDiscord<janakali> (edit) "`static` ... only" added "arguments"
03:47:01FromDiscord<DetermiedNim1> i did not know both of these things so thank you very much
03:47:35FromDiscord<DetermiedNim1> oh actually another question↵↵if i made it a seq[int] how would i access it?
03:47:43FromDiscord<DetermiedNim1> just an int array?
03:48:20FromDiscord<Elegantbeef> Nope
03:50:54FromDiscord<Elegantbeef> `seq[int]` is really `(int, ptr (int, UncheckedArray[T]))`
03:51:04FromDiscord<DetermiedNim1> i see
03:51:15FromDiscord<DetermiedNim1> oh wait so lowk im stupid and forgot to mention
03:51:28FromDiscord<DetermiedNim1> im doing the calling things with uiua
03:51:38FromDiscord<DetermiedNim1> cause i was looking into the ffi
03:51:57FromDiscord<Elegantbeef> Use an `openArray[char]` and that turns into `ptr T, int`
03:52:07FromDiscord<DetermiedNim1> (edit) "ffi" => "ffi↵https://www.uiua.org/docs/&ffi"
03:54:30FromDiscord<DetermiedNim1> https://media.discordapp.net/attachments/371759389889003532/1376045739720970310/image.png?ex=6833e5f6&is=68329476&hm=b1cbff22e446d354266058b47fbcee2bfc22015ae980c5fbcd39a29d75c9a025&
03:55:24FromDiscord<Elegantbeef> Obviously not as a return type
04:00:49FromDiscord<Elegantbeef> I mean `proc doThing(oa: var openArray[T])` turns into `proc doThing(data: ptr UncheckedArray[T], len: int)`
04:00:50FromDiscord<Elegantbeef> Not perfect, but https://github.com/beef331/seeya/blob/master/tests/mylib.nim generates https://github.com/beef331/seeya/blob/master/tests/mylib.h
04:10:03FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "`seq[int]` is really `(int,": `(cap: int, data: ptr (len: int, UncheckedArray[T]))`?
04:10:30FromDiscord<Elegantbeef> len is the value type
04:10:57FromDiscord<Robyn [She/Her]> ah, so then cap is the pointer int before the array
04:11:34FromDiscord<Elegantbeef> Yes
04:15:14FromDiscord<Robyn [She/Her]> epic
04:15:23FromDiscord<Elegantbeef> If you say so
04:41:08FromDiscord<Robyn [She/Her]> In reply to @battery.acid.bubblegum "Anyone know if it's": beef do you know if an iterator macro is a thing or nah?
04:41:20FromDiscord<Elegantbeef> There is a for loop macro
04:42:24FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "There is a for": oh? are there docs for it or no?
04:42:46FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#macros-for-loop-macro
04:44:31FromDiscord<Robyn [She/Her]> yay thanks
05:53:56*tiorock joined #nim
05:53:56*rockcavera is now known as Guest8044
05:53:56*Guest8044 quit (Killed (iridium.libera.chat (Nickname regained by services)))
05:53:56*tiorock is now known as rockcavera
05:56:02*tiorock joined #nim
05:56:02*rockcavera is now known as Guest3849
05:56:02*tiorock is now known as rockcavera
05:58:43*Guest3849 quit (Ping timeout: 252 seconds)
06:20:08*ntat joined #nim
06:48:09*PMunch_ joined #nim
06:50:54*PMunch__ quit (Ping timeout: 252 seconds)
07:24:55*tiorock joined #nim
07:24:55*tiorock quit (Changing host)
07:24:55*tiorock joined #nim
07:24:55*rockcavera quit (Killed (lithium.libera.chat (Nickname regained by services)))
07:24:55*tiorock is now known as rockcavera
07:27:01*tiorock joined #nim
07:27:01*tiorock quit (Changing host)
07:27:01*tiorock joined #nim
07:27:01*rockcavera is now known as Guest8585
07:27:01*Guest8585 quit (Killed (molybdenum.libera.chat (Nickname regained by services)))
07:27:01*tiorock is now known as rockcavera
08:34:24*przmk quit (Remote host closed the connection)
08:34:49*przmk joined #nim
08:36:47*przmk quit (Remote host closed the connection)
08:37:15*przmk joined #nim
08:51:29*przmk quit (Remote host closed the connection)
08:51:55*przmk joined #nim
09:15:54*tiorock joined #nim
09:15:54*tiorock quit (Changing host)
09:15:54*tiorock joined #nim
09:15:54*rockcavera quit (Killed (zinc.libera.chat (Nickname regained by services)))
09:15:54*tiorock is now known as rockcavera
09:18:01*tiorock joined #nim
09:18:02*rockcavera is now known as Guest4459
09:18:02*tiorock is now known as rockcavera
09:21:15*Guest4459 quit (Ping timeout: 268 seconds)
11:40:24*tiorock joined #nim
11:40:24*tiorock quit (Changing host)
11:40:24*tiorock joined #nim
11:40:24*rockcavera quit (Killed (zirconium.libera.chat (Nickname regained by services)))
11:40:24*tiorock is now known as rockcavera
11:42:31*tiorock joined #nim
11:42:31*tiorock quit (Changing host)
11:42:31*tiorock joined #nim
11:42:31*rockcavera is now known as Guest108
11:42:31*tiorock is now known as rockcavera
11:44:58*Guest108 quit (Ping timeout: 245 seconds)
12:59:55*tiorock joined #nim
12:59:55*tiorock quit (Changing host)
12:59:55*tiorock joined #nim
12:59:55*rockcavera quit (Killed (lead.libera.chat (Nickname regained by services)))
12:59:55*tiorock is now known as rockcavera
13:02:01*rockcavera is now known as Guest7676
13:02:01*tiorock joined #nim
13:02:01*Guest7676 quit (Killed (molybdenum.libera.chat (Nickname regained by services)))
13:02:01*tiorock is now known as rockcavera
13:16:47*ntat quit (Quit: leaving)
13:44:23FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=exnjatUW
13:48:14FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=bwqzHyAr
13:53:05FromDiscord<lainlaylie> it's saying keys is an iterator and can't be called like that
14:02:00Amun-Ra
14:09:24*PMunch__ joined #nim
14:12:24*PMunch_ quit (Ping timeout: 260 seconds)
14:18:34*jinn6 quit (Quit: WeeChat 4.4.3)
14:29:33*jinn6 joined #nim
14:40:18*przmk quit (Remote host closed the connection)
14:41:53*przmk joined #nim
15:16:51*xet7 joined #nim
17:16:20*beholders_eye joined #nim
17:57:06*ntat joined #nim
18:02:41FromDiscord<TFed> how i can generate the same hash that i get when i'm installing my package with particular commit via nimble?
18:02:41FromDiscord<TFed> \~/nimble/pkgs2/upen-1.0.1-452edc0c4b4df26dc1058fdd58b89c24650d5c9dwhere this `452edc0c4b4df26dc1058fdd58b89c24650d5c9d` hash came from?
18:02:41FromDiscord<TFed> `~/nimble/pkgs2/upen-1.0.1-452edc0c4b4df26dc1058fdd58b89c24650d5c9d`where this `452edc0c4b4df26dc1058fdd58b89c24650d5c9d` hash came from?
18:03:19FromDiscord<TFed> also how i can determine what version i'm installing?
18:07:14FromDiscord<TFed> also is it possible to install any commit instead of last tag/HEAD?
18:35:57FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=arsMnkqX
18:37:10FromDiscord<Elegantbeef> `nimble install package@commit` if memory serves
18:42:26FromDiscord<TFed> thank you it works with link too↵`nimble install "https://codeberg.org/tfed/[email protected]"`
18:51:42FromDiscord<TFed> i was wondering if i can require this url from `.nimble`
18:51:43FromDiscord<Elegantbeef> Of course
18:51:43FromDiscord<TFed> lemme check
18:51:55FromDiscord<Elegantbeef> Nimble is decentralized afterall a git package is a git package
18:52:52FromDiscord<TFed> sounds cool, thank you again
19:00:06FromDiscord<aintea> Why does the documentation not mention that macros are a hate/love relationship
19:00:12FromDiscord<aintea> It's so good but it's so painful
19:00:31FromDiscord<Elegantbeef> Cause you have to learn the compiler to write them and those that wrote the docs know the compiler
19:04:37*beholders_eye quit (Ping timeout: 268 seconds)
19:09:16FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=iMrXwArj
19:10:06FromDiscord<aintea> Also I don't understand why don't case statements expand to if statements at compile time ? Is there a reason the values in the branches need to be known at compile time ? Or is that just by design
19:10:09FromDiscord<Elegantbeef> I dont't see any `nnkElifBranch`s
19:10:47FromDiscord<Elegantbeef> It's an artificial limitation likely to make the code generation simpler
19:11:37*ftajhii quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
19:12:05FromDiscord<aintea> In reply to @Elegantbeef "I dont't see any": which is weird
19:12:11FromDiscord<aintea> that doesn't make any sense
19:12:22FromDiscord<Elegantbeef> What?
19:13:37FromDiscord<aintea> I don't have any nnkElifBranch in my code
19:13:55FromDiscord<Elegantbeef> Exactly
19:13:57FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=xXzMpZCY
19:14:00FromDiscord<Elegantbeef> You're doing it wrong
19:14:09FromDiscord<aintea> how so
19:14:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=rAmvnHyn
19:14:40FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ndDvYHzy
19:14:55FromDiscord<Elegantbeef> But you should make your match work with `nnkOfBranch` like the static ones I showed
19:15:12FromDiscord<aintea> I see
19:15:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=kENVZsGa
19:15:36FromDiscord<aintea> oh that's nice
19:15:51FromDiscord<Elegantbeef> https://nim-lang.org/docs/macros.html#statements-if-statement
19:16:59FromDiscord<aintea> wait but this just lets me convert my macro into a case statement
19:17:02FromDiscord<aintea> which I do not want
19:17:13FromDiscord<aintea> I absolutely want it to expand to if statements
19:18:48FromDiscord<Elegantbeef> Who said convert it into a case statement?
19:19:06FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=IBmjeqJq
19:19:14FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/master/staticcases.nim
19:19:16FromDiscord<Elegantbeef> Again
19:19:16FromDiscord<aintea> If i try to put this into a dumptree it errors
19:19:27FromDiscord<aintea> yeah I took a look at it and wanted to try to make it by myself
19:19:47FromDiscord<aintea> but this is a bit overkill for what I want to do
19:19:52FromDiscord<Elegantbeef> Well I used micros so you get to port it
19:22:14FromDiscord<Elegantbeef> It's literally what you're doing but intuitively
19:23:29FromDiscord<aintea> my brain hurts
19:23:31FromDiscord<aintea> thanks for helping though
19:23:54FromDiscord<aintea> Now I understand why the documentation says "use something less powerful than macros where you can"
19:28:03FromDiscord<Elegantbeef> They are user defined compiler extensions afterall
19:30:25FromDiscord<heysokam> In reply to @aintea "my brain hurts": literally why I never use them. I'd rather write 100functions manually than create one macro to write them
19:30:50FromDiscord<aintea> yeah but I'm lazy and want a good looking case statement
19:31:13FromDiscord<aintea> funnily enough when the RFC about ML-like pattern matching will be adopted my macro will be worthless
19:31:51*ftajhii joined #nim
20:22:07FromDiscord<nocturn9x> just wondering
20:22:13FromDiscord<nocturn9x> is nim's own memory allocator still unusable with threads?
20:22:26FromDiscord<nocturn9x> I've been using `-d:useMalloc` since I stopped banging my head against the wall wrt threads
20:22:40FromDiscord<nocturn9x> was wondering if I could get rid of that, given that malloc is a small but noticeable performance hit
20:33:08FromDiscord<Elegantbeef> Only way to really know is to test it using memory sanitizers
20:33:08FromDiscord<Elegantbeef> Likely↵(@nocturn9x)
20:48:43FromDiscord<nocturn9x> sad
21:05:14*xet7 quit (Remote host closed the connection)
21:11:50*PMunch_ joined #nim
21:14:59*PMunch__ quit (Ping timeout: 265 seconds)
21:21:58*ntat quit (Quit: leaving)
21:43:52FromDiscord<summarity> In reply to @nocturn9x "is nim's own memory": Source from ~1 week ago: yes. Default allocator leaks, malloc doesn't (tested in a real-world web service)
21:44:09FromDiscord<nocturn9x> oh it leaks that's a fun addition
21:44:14FromDiscord<nocturn9x> I thought it just had race conditions
22:23:04*fabricio joined #nim
23:14:08FromDiscord<Robyn [She/Her]> Iirc there were ppl interested in a nice API for a TOML parser, right? I decided against making my own and am just using https://github.com/NimParsers/parsetoml which is mostly compliant
23:14:33FromDiscord<Robyn [She/Her]> I also made a minimal deserialisation layer which I can share if wanted
23:15:09FromDiscord<Robyn [She/Her]> (Mostly compliant with 1.0.0, there weren't many changes so...)
23:34:05FromDiscord<.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=taExBgqm
23:34:30FromDiscord<.tokyovigilante> (edit) "https://play.nim-lang.org/#pasty=itndfjgF" => "https://play.nim-lang.org/#pasty=YbJcxdWS"
23:35:20FromDiscord<.tokyovigilante> I've been then taking advantage of that to not initialise object members that I want to be zero (or null in the case of pointers) but it has just bitten me when trying to use that for C interop.
23:35:58FromDiscord<.tokyovigilante> Concretely, using the Vulkan API, passing in a createInfo struct assuming that non-initialised members are 0 or null and this not working.
23:41:54FromDiscord<demotomohiro> How to put objects on memory without allocation?↵If you declare variables outside of procs, it is allocated and initialized when the process is created.↵When you declare inside procs, it is allocated on the stack and initialized when the proc is called.↵https://zevv.nl/nim-memory/
23:55:53FromDiscord<.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=BnNgLoaU
23:57:36FromDiscord<.tokyovigilante> I would expect `testObject` to be stack allocated, with space for the `integer` member, but is the output of `echo integer` 0, some random number from uninitialised memory, or... something else? I am expecting the object to be allocated, just not sure if the memory is initialised to zero.