No we should not support enum types derived from strings

Daniel N no at public.email
Fri May 7 17:27:18 UTC 2021


On Friday, 7 May 2021 at 17:16:06 UTC, Steven Schveighoffer wrote:
> On 5/7/21 1:05 PM, Steven Schveighoffer wrote:
>> I think the problem here is that the language doesn't give you 
>> a good way to express that. So we rely on template constraints 
>> that both can't exactly express that intention, and where the 
>> approximations create various template instantiations that 
>> cause strange problems (i.e. if you accept an enum that 
>> converts to string, it's still an enum inside the template). 
>> Whereas the language
>
> I forgot to finish this thought, got interrupted.
>
> Whereas the language (with non-template parameters) does the 
> matching and conversion simultaneously without needing special 
> cases.
>
> -Steve

What's wrong with this?

void fun(T : string)(T t)


More information about the Digitalmars-d mailing list