I dun a DIP, possibly the best DIP ever
Stefan Koch
uplink.coder at googlemail.com
Fri Apr 24 22:04:15 UTC 2020
On Friday, 24 April 2020 at 20:55:19 UTC, Walter Bright wrote:
>
> Another approach to resolving the original problem (template
> instantiation bloat) is for the compiler to recognize templates
> like AliasSeq as "special" and implement them directly.
>
>
> For example, AliasSeq is defined as:
>
> template AliasSeq(TList...) { alias AliasSeq = TList; }
>
> This pattern is so simple it can be recognized by the compiler.
> (Having std.meta.AliasSeq being a special name known to the
> compiler is not necessary.)
> The compiler already recognizes certain patterns, such as the
> expression that does a rotate, and then generates the CPU
> rotate instruction for it.
AliasSeq itself is not the problem at all.
The problem is when operating on AliasSeq you need to instantiate
new templates to keep them in a "TypeExp" state. Where they can
still be manipulated as lists.
You detect operations you might do on type lists and implement
them as special cases in the compiler, but then you end of with
many specialzed cases which have to treated diffrently.
You push complexity from the langauge into the compiler
implementation details.
And that's where it shouldn't be because who is going to verify
that.
People here who are familiar with the c++11 syntax have already
found bugs.
That won't be possible if it's an unspecified set of rewrites
that take place in an unspecified stage.
More information about the Digitalmars-d
mailing list