<< 04-08-2025 >>

00:16:35*GnuYawk1 quit (Quit: The Lounge - https://thelounge.chat)
00:17:05*GnuYawk1 joined #nim
00:45:17*joast joined #nim
00:57:54*redj quit (Ping timeout: 248 seconds)
02:39:48FromDiscord<ollicron_53732> It took everything I had and more to get this working, and the scope of how far I wanted to get to is now done. https://media.discordapp.net/attachments/371759389889003532/1401756477454024755/Screencast_20250803_223637.webm?ex=68916ef3&is=68901d73&hm=cbd702a8fd36f90d4c34ba3f8fca330fc3d03939c187b9b721ea913a9fbb05ff&
02:56:56FromDiscord<Elegantbeef> @ollicron_53732 congrats, what libraries are you using?
02:57:07FromDiscord<ollicron_53732> just sdl
02:57:26FromDiscord<ollicron_53732> and basic2d i was following a guide but I didn't like how he did things
02:59:05FromDiscord<ollicron_53732> sent a code paste, see https://play.nim-lang.org/#pasty=nVoVbwrD
02:59:11FromDiscord<ollicron_53732> https://tenor.com/view/why-persian-room-cat-guardian-but-why-trendizisst-anyaboz-gif-2156104475561014590
02:59:22FromDiscord<Elegantbeef> Using epoch time in a game loop is pretty sinful
03:00:25FromDiscord<ajusa> oh boy Beef is online and I have a macros question.↵↵I tried extending https://github.com/beef331/micros/blob/master/src/micros/introspection.nim to generate a tuple with _named_ parameters, as I'd like to know what the parameter name is for a proc. I couldn't figure out how to do it in the end though, any ideas?
03:00:55FromDiscord<Elegantbeef> Switch to `nnkTupleTy` then emit `nnkIdentDef`s
03:01:27FromDiscord<Elegantbeef> `nnkTupleType(nnkIdentDefs(ident"a", ident"int", nnkEmptyNode))` for `proc(a: int)`
03:04:36FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#pasty=rXDCedIl
03:05:23FromDiscord<Elegantbeef> No
03:06:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=JwMRxEBC
03:06:08FromDiscord<Elegantbeef> You also will likely need to process `a, b: int`
03:06:50FromDiscord<ajusa> shoot that's annoying
03:06:53FromDiscord<ajusa> and default parameters
03:07:09FromDiscord<Elegantbeef> Well it's typed AST so probably not
03:07:45FromDiscord<Elegantbeef> I could of course do this in like 5 minutes, but I'm going to make you struggle so you learn
03:08:09FromDiscord<ajusa> Yes I'm well past the point where I should have learned macros
03:09:18FromDiscord<ajusa> Looks like I wrote the same message in Feb of 2021
03:10:03FromDiscord<Elegantbeef> lol
03:14:51FromDiscord<Elegantbeef> Remember you can always `echo nimNode.treeRepr` and do `dumpTree: tuple[x, y: int]`
03:15:59FromDiscord<ajusa> That is helpful, thanks
03:21:53FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#pasty=VNDIGUyk
03:22:10FromDiscord<Elegantbeef> `ident x[1].strval` is completely wrong
03:22:19FromDiscord<Elegantbeef> What if I have `a: seq[int]`
03:22:24FromDiscord<Elegantbeef> it's just `x[1]`
03:22:31FromDiscord<Elegantbeef> Cause you want the type not the name of the type
03:23:17FromDiscord<ajusa> Ah yes, I saw I needed strVal for the name and symmetrically added it to the type
03:23:38FromDiscord<Elegantbeef> `$x[0]` is also better im
03:23:41FromDiscord<Elegantbeef> imo
03:23:57FromDiscord<ajusa> so treeRepr was giving x[1] as a "sym", and I can swap that out for an "ident" as needed?
03:24:25FromDiscord<Elegantbeef> A symbol is just a semantically check ident, you want to use syms where possible so the compiler doesn't go "Oh I don't know this, let's try to compile this
03:25:25FromDiscord<ajusa> so it's something that's already been compiled/typechecked in a way?
03:25:27FromDiscord<Elegantbeef> You might have a `proc myProc(a: SomeType)` in module `a` then do `import a; let x = default paramType(myProc)` and it'll explode cause `SomeType` is not exported
03:25:37FromDiscord<Elegantbeef> Not in a way it's already typechecked
03:26:03FromDiscord<ajusa> So it's stricter than a raw ident then, thanks for clarifying
03:26:14FromDiscord<ajusa> It took 4 years, but I've finally been forced to learn macros
03:26:27FromDiscord<ajusa> thank you for your service Beef, now I must try to make the comma proc argument work
03:26:39FromDiscord<Elegantbeef> It'll probably already work
03:26:55FromDiscord<ajusa> Yep it just worked
03:27:10FromDiscord<Elegantbeef> Tests and PR it!
03:27:52FromDiscord<ajusa> 🫡
03:31:17*amadaluzia quit (Quit: ZNC 1.10.1 - https://znc.in)
03:34:49*shwouchk joined #nim
03:36:01FromDiscord<ajusa> Done https://github.com/beef331/micros/pull/2
03:42:00FromDiscord<Elegantbeef> Cheers 0.1.17 is live now
03:42:46FromDiscord<ajusa> perfect thanks!
04:41:36FromDiscord<heysokam> In reply to @ollicron_53732 "It took everything I": #epic! great starting point 🔥
05:10:15*nils` quit (Ping timeout: 276 seconds)
06:30:42*nils` joined #nim
06:33:19*skippy8 joined #nim
06:41:15*nils` quit (Ping timeout: 276 seconds)
07:09:50*ntat joined #nim
07:35:15*xet7 joined #nim
07:56:17*SchweinDeBurg quit (Quit: WeeChat 4.8.0-dev)
07:56:44*SchweinDeBurg joined #nim
08:48:10*nils` joined #nim
09:41:54FromDiscord<blashyrk> An interesting property of Nim's default dynamic dispatch is that it can (and does!) get inlined by the C compiler. For a small number of possible subtypes, I wonder if there's any performance benefits to using case objects instead of subtyping at all. Has anyone ever measured this?
09:56:35FromDiscord<blashyrk> In reply to @blashyrk "Am I crazy or": Bump for this as I suspect this is really a compiler bug
10:10:33FromDiscord<ollicron_53732> In reply to @blashyrk "An interesting property of": Yes profesor salewski goes over it in his book you can make a switch case Block on what you want to inherit if I were on my pc id show an example
11:27:28*nils` quit (Ping timeout: 240 seconds)
12:32:53*ntat quit (Quit: Leaving)
12:36:30FromDiscord<blashyrk> Why does this macro "hijack" the object constructor for a type that's passed to it:↵↵https://play.nim-lang.org/#pasty=nvIDIoSO
13:28:52*nils` joined #nim
13:30:36*NimBot joined #nim
14:17:28*xet7_ joined #nim
14:18:46*xet7 quit (Ping timeout: 276 seconds)
14:20:13*xet7_ quit (Remote host closed the connection)
14:44:14*skippy8 quit (Quit: WeeChat 4.6.3)
14:44:39*skippy8 joined #nim
14:46:01*skippy8 quit (Client Quit)
14:51:43*skippy8 joined #nim
14:52:23*skippy8 quit (Client Quit)
14:58:42*ntat joined #nim
15:00:17*zgasma joined #nim
15:04:09*nils` quit (Ping timeout: 245 seconds)
15:25:07*amadaluzia joined #nim
15:43:41*skippy8 joined #nim
15:53:47*skippy8 quit (Quit: WeeChat 4.6.3)
15:54:14*skippy8 joined #nim
16:11:43*nils` joined #nim
17:35:50FromDiscord<blashyrk> Does anyone know how to check if a type is declared from inside a macro? By declared I mean, declared up to the point of invocation of the macro, either in the current module or some impoted module
17:36:06FromDiscord<blashyrk> (edit) "Does anyone know how to check if a type ... is" added "(with some ident)"
17:36:56FromDiscord<blashyrk> (edit) "module" => "module↵↵I tried dynamic bindsym but that doesn't work (it throws an error that the symbol doesn't exist, which is precisely the point, but I don't know how to recover from that compilation error and turn it into a bool)"
17:50:28FromDiscord<Elegantbeef> @blashyrk Avoid trying to convert an ident to a symbol inside of a macro, make an intermediate macro that this one calls after
17:51:17*nils` quit (Ping timeout: 248 seconds)
17:53:14*nils` joined #nim
18:35:53*nyeaa49284230101 quit (Read error: Connection reset by peer)
19:50:23*ntat quit (Quit: Leaving)
19:50:34*skippy8 quit (Quit: WeeChat 4.6.3)
21:27:55FromDiscord<aintea> let's say you were to use a CLI tool that accepts some different values (known at compile time), would you like them to be case sensitive or not ?
21:29:45FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=ARCjdwPa
21:30:18FromDiscord<aintea> if you were using a library to make this kind of cli tools, or if you were to use those said cli tools
21:37:07FromDiscord<Elegantbeef> It's a nice UX to not have to get spelling right especially if you're used to a different styling
21:38:28FromDiscord<Elegantbeef> `removefile` can be written like `remove-file` `removeFile` `removefile` `remove_file` so it's a nice feature to coalesce them all, but it can bring it's own troubles
21:40:20*rockcavera joined #nim
21:43:54Amun-Racreate a completion script and you won't have to worry about that
21:44:12FromDiscord<Elegantbeef> Hey I use fish don't look at me
21:44:20Amun-Rasame here
21:44:28*Amun-Ra stares at Elegantbeef
21:44:30FromDiscord<Elegantbeef> Some people don't ship completion scripts so life is hell
21:44:37Amun-Ratrue
22:39:47*rockcavera is now known as Guest7513
22:39:48*tiorock joined #nim
22:39:48*Guest7513 quit (Killed (mercury.libera.chat (Nickname regained by services)))
22:39:48*tiorock is now known as rockcavera
22:40:02FromDiscord<ollicron_53732> it's really annoying when trying to read code and someone does something fancy
22:40:16FromDiscord<ollicron_53732> just to avoid writing a little more
23:07:50FromDiscord<Kapendev Pythonista Dartista 🦀⚡> Relatable
23:29:41FromDiscord<.bobbbob> why might `if val != nil` cause segfault but `if not isNil(val)` works correctly?
23:30:11FromDiscord<Elegantbeef> Stack corruption
23:31:12FromDiscord<.bobbbob> eh? should isNil always be used or something?
23:31:29Amun-Rathere's a problem somewhere above the line
23:31:34FromDiscord<Elegantbeef> No you should not have your code written in such a way to have a stack corruption
23:31:46FromDiscord<Elegantbeef> If they don't behave the same way you have an issue in your code and need to fix that
23:33:26*amadaluzia quit (Quit: ZNC 1.10.1 - https://znc.in)
23:36:05FromDiscord<.bobbbob> sent a code paste, see https://play.nim-lang.org/#pasty=IuzcFLut
23:43:44FromDiscord<Elegantbeef> Run it with valgrind and `--debugger:native -d:useMalloc`
23:44:01FromDiscord<.bobbbob> it's bad isn't it
23:44:17FromDiscord<Elegantbeef> Well it's a bug
23:48:45*amadaluzia joined #nim
23:54:51FromDiscord<.bobbbob> oh duh, I had an overloaded == for that type but wasnt checking for nil in it