<< 02-09-2026 >>

00:15:30*insanescholar_ joined #nim
00:36:11*KawaiiSelbst quit (Remote host closed the connection)
00:39:49*KawaiiSelbst joined #nim
01:45:22*rockcavera joined #nim
02:22:02*SchweinDeBurg quit (Remote host closed the connection)
02:33:59*rockcavera quit (Remote host closed the connection)
03:13:43*KawaiiSelbst quit (Remote host closed the connection)
03:14:30*KawaiiSelbst joined #nim
03:29:17*Pixi` is now known as Pixi
04:22:15*deavmi quit (Read error: Connection reset by peer)
04:30:35*deavmi joined #nim
05:37:36*GnuYawk1297 joined #nim
05:39:36*GnuYawk129 quit (Ping timeout: 243 seconds)
05:39:36*GnuYawk1297 is now known as GnuYawk129
06:20:43*termer quit (Remote host closed the connection)
06:26:56*termer joined #nim
07:34:21*termer quit (Remote host closed the connection)
07:37:38*termer joined #nim
07:46:26*Skippy8 joined #nim
08:51:45FromDiscord<litlighilit_at_matrix_org> sent a code paste, see https://paste.rs/XOyxE
08:55:48FromDiscord<pmunch> Just `getTypeImpl()[1]` turned out to be enough actually
08:56:02FromDiscord<pmunch> But I still ended up wrapping the whole thing in a macro and doing it that way
08:57:39FromDiscord<litlighilit> that's just the proc type itself.↵(@pmunch)
08:58:07FromDiscord<litlighilit> fine. Anyway haven't found a clearer way
08:58:26FromDiscord<pmunch> Oh yeah, you're right. I changed how my macro works so that's all I ended up needing
08:58:44FromDiscord<pmunch> It's weird though, I thought there was a way to just get it directly without having to write your own macro for it
09:00:39FromDiscord<pmunch> sent a long message, see https://paste.rs/UC6w5
09:01:18FromDiscord<pmunch> Hmm, imagine that those double backticks are single backticks, not sure how to add those inside a code block on Discord
09:01:52FromDiscord<litlighilit> okay, markdown backtick notation
09:02:45FromDiscord<litlighilit> sounds weird indeed
09:07:42FromDiscord<litlighilit> I guess it's due to unrelated bug like uninitialized ref obj
09:10:40FromDiscord<pmunch> Hmm, ran it under GDB and it looks like an infinite recursion
09:11:01FromDiscord<pmunch> Which is weird
09:11:09FromDiscord<litlighilit> I just failed to replay the segfault
09:11:51FromDiscord<pmunch> Failed to replay?
09:12:01FromDiscord<pmunch> Hold on, let me create a minimal reproduction
09:12:32FromDiscord<litlighilit> looks my code test according to your desc didn't match what you wrote
09:14:07FromDiscord<litlighilit> sent a code paste, see https://paste.rs/JVRZ6
09:14:20FromDiscord<litlighilit> sent a code paste, see https://paste.rs/WNY0b
09:22:09FromDiscord<pmunch> sent a code paste, see https://paste.rs/TI1LJ
09:22:37FromDiscord<pmunch> Does yours work?
09:23:15FromDiscord<pmunch> Ah, I think it might be the bare Token version in module 1
09:23:29FromDiscord<pmunch> In this simple test I get Nims infinite recursion error
09:23:47FromDiscord<pmunch> At it points to the bare Token as what bounces it back
09:24:35FromDiscord<pmunch> So `module1.\`$\` (token)` resolves to the wrong method..
09:24:44FromDiscord<pmunch> (edit) "`module1.\`$\`" => "`module1.``$``"
09:25:01FromDiscord<pmunch> Even though `token` is `CodeBlock`
09:26:38FromDiscord<litlighilit> change `module2.`$` ` from method to proc
09:28:39FromDiscord<litlighilit> Defining double method for the same type like CodeBlock is ill-formed
09:29:11FromDiscord<pmunch> Unfortunately that doesn't work
09:29:21FromDiscord<pmunch> When it's a proc it doesn't dynamically resolve as it should
09:29:29FromDiscord<pmunch> So my proc is never called in the real code
09:30:33FromDiscord<litlighilit> nope.↵`module2.`$` ` will be called first
09:30:50FromDiscord<litlighilit> iff in module2
09:31:00FromDiscord<pmunch> If you change the initialization to `var x = CodeBlock().Token` you will see what I mean
09:31:21FromDiscord<litlighilit> and CodeBlock is the child type
09:31:33FromDiscord<pmunch> When it's a method it works fine and module2 is called, but when it's a proc module1 gets called
09:32:01FromDiscord<litlighilit> yes↵(@pmunch)
09:32:16FromDiscord<litlighilit> but anyway
09:33:51FromDiscord<litlighilit> If you don't wanna call `module1.`$` `, then maybe use `import module1 except `$` `
09:35:18FromDiscord<litlighilit> I don't think defining the same method multiply times is a good style
09:37:06FromDiscord<pmunch> Hmm, that might work
09:38:26FromDiscord<pmunch> Nope, same thing
09:38:56FromDiscord<pmunch> My problem is that I _want_ ta call `module1.$`, but only from within `module2.$`
09:40:17FromDiscord<litlighilit> The definition of module2 modifies the pointer of method (VTable) CodeBlock.↵Using `module1.`$` ` just means\: use that pointer
09:40:25FromDiscord<litlighilit> So it deadloop
09:42:15FromDiscord<litlighilit> So another solution is moving impl of `module1.`$` ` to a new exported proc.↵then invoke it in `module1.`$` `↵and `module2.`$` `
09:45:01FromDiscord<litlighilit> But neither is recommended.
09:45:03FromDiscord<litlighilit> just remember this
09:46:21FromDiscord<pmunch> Unfortunately I can't module module1 as it is from another package
09:47:58FromDiscord<litlighilit> Just place the new exported proc in module2.nim
09:49:18FromDiscord<pmunch> Of course, but at that point I can just copy the implementation of `module1.$` into `module2.$` which is what I'm trying to avoid
09:50:05FromDiscord<litlighilit> I mean\:
09:50:23FromDiscord<litlighilit> sent a code paste, see https://paste.rs/RHlUN
09:51:38FromDiscord<pmunch> Oh, would that work?
09:52:27FromDiscord<pmunch> Nope, still infinite loop
09:52:46FromDiscord<litlighilit> oh right
09:53:35FromDiscord<litlighilit> So firstly summarize\: you want change all Token.`$` behavior as your implementation
09:53:36FromDiscord<pmunch> sent a code paste, see https://paste.rs/ak7Y7
09:55:22FromDiscord<pmunch> Well, in reality module1 contains some 150 lines of `$` procedures for 30 different objects that inherit from Token. I want to, for each of the 30 objects, add a thin shim that calls the original and then adds a bit extra to each string.
09:56:07FromDiscord<litlighilit> okay, saving the module1.`$` as variable on module2.nim shall achieve this
09:57:11FromDiscord<pmunch> As a variable?
09:59:39FromDiscord<litlighilit> sent a code paste, see https://paste.rs/Qsn9y
09:59:58FromDiscord<litlighilit> sent a code paste, see https://paste.rs/RqjQz
10:02:30FromDiscord<litlighilit> ...not work either
10:04:00FromDiscord<pmunch> Eureka
10:04:18FromDiscord<litlighilit> huh... I start to wanna use macros.getImpl
10:04:21FromDiscord<pmunch> sent a code paste, see https://paste.rs/gNvGF
10:05:57FromDiscord<pmunch> Coercing it with the typed variable to only select the CodeBlock variant and not go via the Token variant that bounces me back
10:06:44FromDiscord<pmunch> I can now write a small macro that just generates all these small wrappers for me
10:27:47*SchweinDeBurg joined #nim
11:21:50*Skippy8 quit (Ping timeout: 262 seconds)
11:30:20*Skippy8 joined #nim
12:05:31*insanescholar_ quit (Remote host closed the connection)
12:13:55*Skippy8 quit (Ping timeout: 240 seconds)
12:45:19*Skippy8 joined #nim
12:54:57FromDiscord<pmunch> Hmm, annoyingly it doesn't work when the method is generated by a macro..
12:55:01FromDiscord<pmunch> No idea why
12:59:45FromDiscord<pmunch> Hmm, I can build a template that works
13:00:12FromDiscord<pmunch> But creating a macro that just creates a bunch of calls and it doesn't work any more..
13:23:35*insanescholar_ joined #nim
13:25:02*insanescholar_ quit (Remote host closed the connection)
13:49:39FromDiscord<b0rsuk> sent a code paste, see https://paste.rs/gQEbR
13:50:46FromDiscord<b0rsuk> I also couldn't find it by searching this discord, but it's hard to search for (`no parentheses`, `no parameters`, `without parentheses`, `without parameters`...)
13:55:49*Skippy8 quit (Ping timeout: 256 seconds)
14:02:44*Skippy8 joined #nim
14:09:48FromDiscord<pmunch> It's true though, you don't need parenthesis when you don't have arguments
14:09:57FromDiscord<b0rsuk> There are a few more examples. Some, but not all, occurrences of `proc main` appear without parentheses.
14:10:08FromDiscord<b0rsuk> (edit) "parentheses." => "parentheses(in the Manual)."
14:10:57FromDiscord<pmunch> Realized that it's not because the code is generated by a macro, but because it enters `module1` through one method and never leaves, so only the first of my overrides run..
14:25:05*termer quit (Remote host closed the connection)
14:28:22*termer joined #nim
14:34:06FromDiscord<janakali> sent a code paste, see https://paste.rs/D0zJk
14:35:14FromDiscord<pmunch> Hmm, I'm starting to think that this isn't possible..
14:36:12FromDiscord<pmunch> I tried to copy all the methods over to a new module, and then only import the things I needed explicitly (so no `$` from the base module). But calling `$` still calls into the base module and ignores all my overrides..
14:36:40FromDiscord<pmunch> It seems it finds the `{.base.}` method regardless
14:38:11FromDiscord<pmunch> Ugh, that means I need to fork the entire package just to get this working
14:38:45FromDiscord<pmunch> Hmm, or I guess I could use something other than `$`..
14:40:49*Skippy8 quit (Ping timeout: 243 seconds)
14:44:19FromDiscord<pmunch> Yes! That worked!
14:47:23FromDiscord<pmunch> A lot less elegant than I would've wanted, but at least it works
14:50:02*Skippy8 joined #nim
14:54:22*KawaiiSelbst quit (Remote host closed the connection)
14:54:39*KawaiiSelbst joined #nim
14:57:32*kotrcka joined #nim
14:58:31*joast quit (Ping timeout: 262 seconds)
15:00:39*joast joined #nim
15:21:04*KawaiiSelbst quit (Remote host closed the connection)
15:21:21*KawaiiSelbst joined #nim