No we should not support enum types derived from strings
deadalnix
deadalnix at gmail.com
Mon May 10 00:46:58 UTC 2021
On Sunday, 9 May 2021 at 02:57:42 UTC, Walter Bright wrote:
> On 5/7/2021 7:16 AM, Paul Backus wrote:
>> "Is a string type" and "is implicitly convertible to a string
>> type" are not the same thing.
>
> Language lawyer point:
>
> An enum can be implicitly converted to its base type, but it's
> a match level 2:
>
> https://dlang.org/spec/function.html#function-overloading
>
> (Agreeing with Paul)
Sorry to be blunt, but this is complete language layering fail.
Classes implementing and interface are a subtype and are match
level 2 (implicit conversion) when matching against the interface.
In fact, any subtype is expected to be a match level 2 -
arguably, this isn't bijective, as not all level 2 match will be
subtypes, that doesn't definitively nails the topic at hand, but
the argument made in this thread are disturbingly unsound.
More information about the Digitalmars-d
mailing list