<< 18-09-2026 >>

00:24:21*Guest47 joined #nim
00:30:31*Guest47 quit (Quit: Client closed)
00:31:40*insanescholar joined #nim
02:56:24*rockcavera quit (Remote host closed the connection)
04:04:39*SchweinDeBurg joined #nim
04:43:59*insanescholar quit (Remote host closed the connection)
08:41:18*hygo joined #nim
09:22:41*insanescholar joined #nim
09:28:13*insanescholar quit (Ping timeout: 274 seconds)
11:12:25*insanescholar joined #nim
11:44:06*SchweinDeBurg quit (Remote host closed the connection)
11:44:21*SchweinDeBurg joined #nim
11:56:38*insanescholar quit (Remote host closed the connection)
12:09:32*SchweinD1 joined #nim
12:09:33*SchweinDeBurg quit (Remote host closed the connection)
12:37:16FromDiscord<pmunch> sent a code paste, see https://paste.rs/eDclH
12:37:29FromDiscord<pmunch> But I'm struggling with how to generate the check
12:38:05FromDiscord<pmunch> The macro must return a `TypeDef` node to fit within the `TypeSection`, so I can't really generate anything else..
12:41:04FromDiscord<pmunch> And I can't seem to accept a `typed` argument into the `checkSize` macro, so I can't get the size of Test2 on compile time
13:12:16FromDiscord<b0rsuk> How can Nim be inspired by Pascal when it doesn't even have the walrus operator? `:=`
13:12:59FromDiscord<b0rsuk> But Python does!
13:15:13FromDiscord<gesee37> sent a long message, see https://paste.rs/eGYOR
13:16:20FromDiscord<gesee37> In reply to @b0rsuk "How can Nim be": What's the use of it ?
13:17:08FromDiscord<b0rsuk> Correct me if I'm wrong, but the size of `bool` is pre-determined, and the size of `int` depends on architecture. But you can tell Nim to use, for example, int16 rather than int?
13:17:28FromDiscord<pmunch> In reply to @b0rsuk "How can Nim be": How can French be inspired by Latin when it doesn't even have seven cases!
13:18:19FromDiscord<pmunch> In reply to @gesee37 "Well you are kind": Well I was trying to improve a long type section with a section of assertions after it..
13:18:29FromDiscord<pmunch> So the syntax was really the main improvement
13:18:50FromDiscord<b0rsuk> In reply to @gesee37 "What's the use of": It's a bit like the a++ or ++a operators in C I guess? But they allow you to make an assignment and comparison at the same time (in Python).
13:20:21FromDiscord<gesee37> In reply to @pmunch "Well I was trying": Well can make a macro that take an untyped type section where each type has a `{.checkSize: xx.}` pragma
13:20:45FromDiscord<b0rsuk> sent a code paste, see https://paste.rs/AL2it
13:21:11FromDiscord<gesee37> In reply to @gesee37 "Well can make a": And generate static assert after or block them in the macro
13:21:27FromDiscord<b0rsuk> I think you're forced to add parentheses if you use the walrus.
13:22:28FromDiscord<gesee37> In reply to @b0rsuk "I'm not familiar with": Oh the definition operator (in math)↵↵Well can make some syntax easier↵I think you can do that with template... even though you will run in some scoping issues
13:25:03FromDiscord<pmunch> sent a code paste, see https://paste.rs/mrK4B
13:25:06FromDiscord<pmunch> Does that work?
13:25:46FromDiscord<pmunch> Yup
13:28:27FromDiscord<b0rsuk> I was just teasing. I know very little about Pascal and the most distinctive thing I know is the `:=`.
13:29:49FromDiscord<b0rsuk> But that is why the similarity to Pascal intrigues me.
13:37:35FromDiscord<pmunch> Araq used to program is Delphi and the first Nim compiler was written in it IIRC
13:37:42FromDiscord<pmunch> That's why it has some similarities
13:51:53FromDiscord<pmunch> Hmm, did something change with implicit return from blocks in 2.2.0?
13:56:24FromDiscord<Laylie> pmunch, if you're still looking\: https://paste.tchncs.de/upload/falcon-snail-deer
14:03:35FromDiscord<pmunch> Huh, how the fuck does _that_ work?
14:03:47FromDiscord<pmunch> Can you just add random `static` blocks to a type section?
14:05:21FromDiscord<Laylie> the only documentation i can find on it is this https://nim-lang.org/docs/manual_experimental.html#extended-macro-pragmas
14:05:28FromDiscord<Laylie> i always end up referring to metagn's skinsuit
14:05:29FromDiscord<pmunch> Wait, you're creating a nested type block?!
14:05:55FromDiscord<pmunch> Yeah I know you can create macros like that
14:06:06FromDiscord<pmunch> I just couldn't figure out how to run static code from within the code-block
14:06:52FromDiscord<Laylie> as far as i can understand it, nim allows you to return a dummy typesection (our `_`) that contains stuff other than types
14:07:26FromDiscord<Laylie> yeppers, nested type block
14:07:58FromDiscord<pmunch> Wild, never seen that before
14:08:05FromDiscord<pmunch> But thanks!
14:09:48FromDiscord<Laylie> specifically the part where it says↵> The ability to return nodes other than type definitions may also be supported, however currently this is not convenient when dealing with mutual type recursion. For now, macros can return an unused type definition where the right-hand node is of kind nnkStmtListType. Declarations in this node will be attached to the same scope as the parent scope of the type section.
14:15:25FromDiscord<pmunch> In reply to @pmunch "Hmm, did something change": Figured this out, it was that a `template` needs `: untyped` as the return if implicit returns should bubble through it.
14:16:18FromDiscord<gesee37> sent a code paste, see https://paste.rs/qIVk2
14:16:37FromDiscord<gesee37> Suprised that `n` is alove outside the parenthesis
14:16:45FromDiscord<gesee37> (edit) "alove" => "alive"
14:17:38FromDiscord<pmunch> If only I could read.. I looked at that documentation page before asking my question @Laylie, but I stopped when I thought it was only repeating stuff I knew..
14:18:38FromDiscord<pmunch> @gesee37, I think it's because () doesn't create a new scope like `block` does. And the `if` is technically part of it's own scope
14:18:41FromDiscord<pmunch> Or something like thta
15:02:16FromDiscord<_timurski> In reply to @pmunch "Figured this out, it": yeah I had this issue with a macro and was very confused. it just gets interpreted as a statement without that return type