No we should not support enum types derived from strings
Walter Bright
newshound2 at digitalmars.com
Tue May 11 19:37:55 UTC 2021
On 5/11/2021 12:14 PM, deadalnix wrote:
> I think your case here is disingenuous, because an int is not a special kind of
> float.
D has no notion of a "special kind of type". It only has a notion of "implicitly
convertible".
* An int is implicitly convertible to a float.
* An enum is implicitly convertible to its base type.
The two *must* behave the same way, or the language falls apart with hackish
special cases that will never work in a predictable manner.
One could design a language with two kinds of conversions:
1. is-a-special-case-of
2. is-implicitly-convertible-to
but D isn't it.
More information about the Digitalmars-d
mailing list