No we should not support enum types derived from strings

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue May 11 16:39:05 UTC 2021


On 5/11/21 12:13 PM, deadalnix wrote:
> On Tuesday, 11 May 2021 at 15:19:05 UTC, Andrei Alexandrescu wrote:
>> On 5/11/21 10:34 AM, deadalnix wrote:
>>> On Tuesday, 11 May 2021 at 13:56:50 UTC, Andrei Alexandrescu wrote:
>>>> Then enum strings are not ranges, correct?
>>>
>>> They are not. But they are strings. Which imply that string aren't 
>>> ranges, which is right, `ref strings` are ranges, not strings.
>>
>> `ref string` is not a type.
> 
> This is just denial.

It's simple fact.

> There are many exemple of conversions that differs with string and ref 
> strings which do not involve enums. For instance, immutable(string) -> 
> string is a valid conversion, but immutable(string) -> ref string isn't.
> 
> Call it something else than a type if you want, nevertheless, 
> conversions rules are simply different, even if you abstract the notion 
> of rvalue/lvalue from the whole thing, so it is clearly more than just a 
> regular storage class.
> 
> When you say ref, you say "I do not want a subtype". Saying B isn't a 
> subtype of A because I can't pass a B to what expects a ref A is just 
> fallacious.

Again with moving the goalposts.


More information about the Digitalmars-d mailing list