No we should not support enum types derived from strings

deadalnix deadalnix at gmail.com
Tue May 11 18:39:14 UTC 2021


On Tuesday, 11 May 2021 at 16:44:03 UTC, Andrei Alexandrescu 
wrote:
> By the same token you can't make up your own definition of what 
> subtyping is and isn't. Value types and reference types are 
> well-trodden ground. You can't just claim new terminology and 
> then prove your own point by using it.

I simply removed an assumption that isn't relevant to the case 
I'm making, namely wether you consider ref string to be a type or 
not, because it doesn't affect the conclusion and therefore isn't 
a debate worth getting into.

You made the point that SomeEnumString cannot be considered a 
subtype of string because things start breaking when it is passed 
by ref, and I retort that the exact same things break in the 
exact same way for subtypes, making your argument moot.

You say "B is not a subtype of A because it exhibit behavior X 
when passed by ref"
I say "D is a known subtype of C, and it also exibhit behavior X 
when passed by ref, therefore X cannot be used as a justification 
that B isn't a subtype of A"

We can argue to no end about what is the right definition that 
should be used for X, but it really doesn't change the overall 
point that is being made.


More information about the Digitalmars-d mailing list