TypeFunction example: ImplictConvTargets

Paul Backus snarwin at gmail.com
Wed Oct 7 14:29:39 UTC 2020


On Wednesday, 7 October 2020 at 14:01:51 UTC, Daniel K wrote:
> If we boil down the Type Function proposal to its fundamental 
> idea, advantages, and deficiencies. What Do we get?
>
> [...]
>
> Advantage:
> Mutating a set of types in an imperative style. Something that 
> is already quite simple, and requires virtually the same, or 
> even less code in practice when written with existing language 
> features.
>
> Disadvantage: A new feature people will have to learn and 
> understand, document, maintain, bugfix.
> No actual substantial future gain.
>
> Is this wrong?

The big advantage you're missing is that, because type functions 
are so restricted in what they can do, they can be implemented 
much more efficiently in the compiler. For large programs that 
make heavy use of D's metaprogramming features, that can really 
add up.


More information about the Digitalmars-d mailing list