How templates work (bonus) - Full instantiation of Iota!(1,5)

Stefan Koch uplink.coder at googlemail.com
Thu Jun 4 12:08:58 UTC 2020


On Thursday, 4 June 2020 at 12:03:00 UTC, Simen Kjærås wrote:
> On Thursday, 4 June 2020 at 11:33:48 UTC, Stefan Koch wrote:
>> [...]
>
> The way you're doing it seems to change about halfway (notice 
> the sudden change in slope in the indentation at Seq!(3, ...)), 
> and it's not really proper D in any case, but there's a few 
> missing exclamation marks (after Iota in Seq!(2, Iota(2 + 1, 
> 5)), and after the final Seq in }.Seq => (3, Seq!(4, Seq())))). 
> There's also a spurious set of parentheses in }.Seq => (2, 
> (Seq!(3, Seq!(4, Seq!())))).
>
> [...]

The reason I show every step explicitly is because that's what's 
the compiler has to do.
I actually did omit a few steps. Such as finding the right 
template declaration to use.
Which requires you to go up the scopes you just created.


More information about the Digitalmars-d mailing list