No we should not support enum types derived from strings

deadalnix deadalnix at gmail.com
Mon May 10 12:19:07 UTC 2021


On Monday, 10 May 2021 at 04:21:34 UTC, Andrei Alexandrescu wrote:
> So you have a range r of type T.
>
> You call r.popFront().
>
> Obvioulsly the type of r should stay the same because in D 
> variables don't change type.
>
> So... what gives, young Padawan?
>
> No, this is not subtyping 101.

If you have a range of T, then you got to return a T. I'm not 
sure what's the problem is here. Do you have a concrete example?

All I can think of are things like slicing and alike, and they 
should obviously return a string, not a T.


More information about the Digitalmars-d mailing list