Imperative Templates
monkyyy
crazymonkyyy at gmail.com
Fri May 10 22:05:43 UTC 2024
On Friday, 10 May 2024 at 13:29:24 UTC, Atila Neves wrote:
> On Wednesday, 8 May 2024 at 14:56:37 UTC, monkyyy wrote:
>> Allow saner escape hatches for state-ful templates, instead of
>> compiler ~~bugs~~ fun unintended features with generally
>> horrible proforence, syntax and limitations
>>
>> ---
>>
>> `__COUNTER__` a special token that increases by 1 each time its
>
> This is a recipe for bugs wrt differences between compiling
> separately or not.
I kinda expect allot of criticism of "you shouldn't even want
this" but my response will be "its already possible, people just
cant read it"
I believe my `mixin("__LINE__")` method to make a counter will
also break with separate compilation so _such things are already
in the compiler_. If this is the main criticism you have, maybe
it would be possible to add a field to .o files that sets the
starting point of counter, so if the counter for foo.o ended at 3
and you compile `dmd bar.d foo.o` `bar.__COUNTER__` is 4.
More information about the dip.ideas
mailing list