Using multiple mixin templates to implement operator overloading

Paul Backus snarwin at gmail.com
Sat Dec 12 21:29:01 UTC 2020


On Saturday, 12 December 2020 at 20:25:48 UTC, Adam D. Ruppe 
wrote:
> On Saturday, 12 December 2020 at 18:14:31 UTC, Paul Backus 
> wrote:
>> IMO this is one of the stupider design decisions in D, but 
>> it's unlikely it will ever be fixed.
>
> It is useful in several other contexts though, including user 
> overriding and private data stores for the mixin.

Sure, but you can always opt in to that behavior by giving the 
mixin a name. The fact that you can't opt out of it even if you 
want to is the issue.

It's essentially the same flaw Andrei criticized C++'s `if 
constexpr` for [1].

[1] https://www.youtube.com/watch?v=tcyb1lpEHm0&t=45m20s


More information about the Digitalmars-d-learn mailing list