| 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:45 | FromDiscord | <litlighilit_at_matrix_org> sent a code paste, see https://paste.rs/XOyxE |
| 08:55:48 | FromDiscord | <pmunch> Just `getTypeImpl()[1]` turned out to be enough actually |
| 08:56:02 | FromDiscord | <pmunch> But I still ended up wrapping the whole thing in a macro and doing it that way |
| 08:57:39 | FromDiscord | <litlighilit> that's just the proc type itself.↵(@pmunch) |
| 08:58:07 | FromDiscord | <litlighilit> fine. Anyway haven't found a clearer way |
| 08:58:26 | FromDiscord | <pmunch> Oh yeah, you're right. I changed how my macro works so that's all I ended up needing |
| 08:58:44 | FromDiscord | <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:39 | FromDiscord | <pmunch> sent a long message, see https://paste.rs/UC6w5 |
| 09:01:18 | FromDiscord | <pmunch> Hmm, imagine that those double backticks are single backticks, not sure how to add those inside a code block on Discord |
| 09:01:52 | FromDiscord | <litlighilit> okay, markdown backtick notation |
| 09:02:45 | FromDiscord | <litlighilit> sounds weird indeed |
| 09:07:42 | FromDiscord | <litlighilit> I guess it's due to unrelated bug like uninitialized ref obj |
| 09:10:40 | FromDiscord | <pmunch> Hmm, ran it under GDB and it looks like an infinite recursion |
| 09:11:01 | FromDiscord | <pmunch> Which is weird |
| 09:11:09 | FromDiscord | <litlighilit> I just failed to replay the segfault |
| 09:11:51 | FromDiscord | <pmunch> Failed to replay? |
| 09:12:01 | FromDiscord | <pmunch> Hold on, let me create a minimal reproduction |
| 09:12:32 | FromDiscord | <litlighilit> looks my code test according to your desc didn't match what you wrote |
| 09:14:07 | FromDiscord | <litlighilit> sent a code paste, see https://paste.rs/JVRZ6 |
| 09:14:20 | FromDiscord | <litlighilit> sent a code paste, see https://paste.rs/WNY0b |
| 09:22:09 | FromDiscord | <pmunch> sent a code paste, see https://paste.rs/TI1LJ |
| 09:22:37 | FromDiscord | <pmunch> Does yours work? |
| 09:23:15 | FromDiscord | <pmunch> Ah, I think it might be the bare Token version in module 1 |
| 09:23:29 | FromDiscord | <pmunch> In this simple test I get Nims infinite recursion error |
| 09:23:47 | FromDiscord | <pmunch> At it points to the bare Token as what bounces it back |
| 09:24:35 | FromDiscord | <pmunch> So `module1.\`$\` (token)` resolves to the wrong method.. |
| 09:24:44 | FromDiscord | <pmunch> (edit) "`module1.\`$\`" => "`module1.``$``" |
| 09:25:01 | FromDiscord | <pmunch> Even though `token` is `CodeBlock` |
| 09:26:38 | FromDiscord | <litlighilit> change `module2.`$` ` from method to proc |
| 09:28:39 | FromDiscord | <litlighilit> Defining double method for the same type like CodeBlock is ill-formed |
| 09:29:11 | FromDiscord | <pmunch> Unfortunately that doesn't work |
| 09:29:21 | FromDiscord | <pmunch> When it's a proc it doesn't dynamically resolve as it should |
| 09:29:29 | FromDiscord | <pmunch> So my proc is never called in the real code |
| 09:30:33 | FromDiscord | <litlighilit> nope.↵`module2.`$` ` will be called first |
| 09:30:50 | FromDiscord | <litlighilit> iff in module2 |
| 09:31:00 | FromDiscord | <pmunch> If you change the initialization to `var x = CodeBlock().Token` you will see what I mean |
| 09:31:21 | FromDiscord | <litlighilit> and CodeBlock is the child type |
| 09:31:33 | FromDiscord | <pmunch> When it's a method it works fine and module2 is called, but when it's a proc module1 gets called |
| 09:32:01 | FromDiscord | <litlighilit> yes↵(@pmunch) |
| 09:32:16 | FromDiscord | <litlighilit> but anyway |
| 09:33:51 | FromDiscord | <litlighilit> If you don't wanna call `module1.`$` `, then maybe use `import module1 except `$` ` |
| 09:35:18 | FromDiscord | <litlighilit> I don't think defining the same method multiply times is a good style |
| 09:37:06 | FromDiscord | <pmunch> Hmm, that might work |
| 09:38:26 | FromDiscord | <pmunch> Nope, same thing |
| 09:38:56 | FromDiscord | <pmunch> My problem is that I _want_ ta call `module1.$`, but only from within `module2.$` |
| 09:40:17 | FromDiscord | <litlighilit> The definition of module2 modifies the pointer of method (VTable) CodeBlock.↵Using `module1.`$` ` just means\: use that pointer |
| 09:40:25 | FromDiscord | <litlighilit> So it deadloop |
| 09:42:15 | FromDiscord | <litlighilit> So another solution is moving impl of `module1.`$` ` to a new exported proc.↵then invoke it in `module1.`$` `↵and `module2.`$` ` |
| 09:45:01 | FromDiscord | <litlighilit> But neither is recommended. |
| 09:45:03 | FromDiscord | <litlighilit> just remember this |
| 09:46:21 | FromDiscord | <pmunch> Unfortunately I can't module module1 as it is from another package |
| 09:47:58 | FromDiscord | <litlighilit> Just place the new exported proc in module2.nim |
| 09:49:18 | FromDiscord | <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:05 | FromDiscord | <litlighilit> I mean\: |
| 09:50:23 | FromDiscord | <litlighilit> sent a code paste, see https://paste.rs/RHlUN |
| 09:51:38 | FromDiscord | <pmunch> Oh, would that work? |
| 09:52:27 | FromDiscord | <pmunch> Nope, still infinite loop |
| 09:52:46 | FromDiscord | <litlighilit> oh right |
| 09:53:35 | FromDiscord | <litlighilit> So firstly summarize\: you want change all Token.`$` behavior as your implementation |
| 09:53:36 | FromDiscord | <pmunch> sent a code paste, see https://paste.rs/ak7Y7 |
| 09:55:22 | FromDiscord | <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:07 | FromDiscord | <litlighilit> okay, saving the module1.`$` as variable on module2.nim shall achieve this |
| 09:57:11 | FromDiscord | <pmunch> As a variable? |
| 09:59:39 | FromDiscord | <litlighilit> sent a code paste, see https://paste.rs/Qsn9y |
| 09:59:58 | FromDiscord | <litlighilit> sent a code paste, see https://paste.rs/RqjQz |
| 10:02:30 | FromDiscord | <litlighilit> ...not work either |
| 10:04:00 | FromDiscord | <pmunch> Eureka |
| 10:04:18 | FromDiscord | <litlighilit> huh... I start to wanna use macros.getImpl |
| 10:04:21 | FromDiscord | <pmunch> sent a code paste, see https://paste.rs/gNvGF |
| 10:05:57 | FromDiscord | <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:44 | FromDiscord | <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:57 | FromDiscord | <pmunch> Hmm, annoyingly it doesn't work when the method is generated by a macro.. |
| 12:55:01 | FromDiscord | <pmunch> No idea why |
| 12:59:45 | FromDiscord | <pmunch> Hmm, I can build a template that works |
| 13:00:12 | FromDiscord | <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:39 | FromDiscord | <b0rsuk> sent a code paste, see https://paste.rs/gQEbR |
| 13:50:46 | FromDiscord | <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:48 | FromDiscord | <pmunch> It's true though, you don't need parenthesis when you don't have arguments |
| 14:09:57 | FromDiscord | <b0rsuk> There are a few more examples. Some, but not all, occurrences of `proc main` appear without parentheses. |
| 14:10:08 | FromDiscord | <b0rsuk> (edit) "parentheses." => "parentheses(in the Manual)." |
| 14:10:57 | FromDiscord | <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:06 | FromDiscord | <janakali> sent a code paste, see https://paste.rs/D0zJk |
| 14:35:14 | FromDiscord | <pmunch> Hmm, I'm starting to think that this isn't possible.. |
| 14:36:12 | FromDiscord | <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:40 | FromDiscord | <pmunch> It seems it finds the `{.base.}` method regardless |
| 14:38:11 | FromDiscord | <pmunch> Ugh, that means I need to fork the entire package just to get this working |
| 14:38:45 | FromDiscord | <pmunch> Hmm, or I guess I could use something other than `$`.. |
| 14:40:49 | * | Skippy8 quit (Ping timeout: 243 seconds) |
| 14:44:19 | FromDiscord | <pmunch> Yes! That worked! |
| 14:47:23 | FromDiscord | <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 |