[Semi-OT] to!string(enumType)

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Fri May 19 14:25:22 PDT 2017


On Friday, 19 May 2017 at 21:23:11 UTC, Dominikus Dittes Scherkl 
wrote:
> On Friday, 19 May 2017 at 21:04:24 UTC, Stefan Koch wrote:
>
>> If a template does trigger a static assert,
>> that static assert is ignored if there is another template in 
>> the overload set that could match.
>
> Wow. Didn't know that.
> Is this really part of the D grammar?
> Sometimes D is soo cool.
>
> Still - too cool for me to see this. I don't like templates 
> looking similar and even taking the same types but the compiler 
> does something too intelligent to avoid an ambiguity.
>
> And it's not visible from the API or documentation - you need 
> to look into the source to disambiguate - I'm not convinced and 
> still consider this bad style.

If they take exactly the same parameters the compiler will flag 
an error.
But if the parameters are merely compatible you can use static 
assert, to shoot things out of the overload set.


More information about the Digitalmars-d mailing list