Alias Vs. Enum?

Timon Gehr timon.gehr at gmx.ch
Sat Jan 6 23:38:04 UTC 2018


On 06.01.2018 22:36, Rubn wrote:
> Tab + Enter + No Delete/Edit = :/
> 
> 
> template valueOf(alias v) // <-- alias
> {
>      alias valueOf = v;
> }
> 
> alias aa = valueOf!(10 == 10);
> enum  ee = 10 == 10;
> 
> alias err = 10 == 10; // error
> 
> 
> Can't alias just be extended to support enum values as well instead of 
> having this workaround with templates?

Yes, it can.

> Is there any reason this hasn't 
> already been done?
> 
> 
> 

Nobody stepped up and did it, I guess.

I might write a DIP to clean up the language grammar at some point. 
(There are a few more cases like this one.)


More information about the Digitalmars-d mailing list