No we should not support enum types derived from strings

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri May 7 20:51:21 UTC 2021


On 5/7/21 2:22 PM, Jacob Carlborg wrote:
> On 2021-05-07 17:24, Andrei Alexandrescu wrote:
> 
>> Compare all that with:
>>
>> 0. We put a String type in the standard library. It uses UTF8 inside 
>> and supports iteration by either bytes, UTF8, UTF16, or UTF32. It 
>> manages its own memory so no need for the GC. It disallows remote 
>> coupling across callers/callees. Case closed.
> 
> You can have enums with the base type being a struct or a class. How 
> does putting a String type in the standard library help with the enum 
> problem you're describing?

The solution to that is "We do not support enums". But if you use a 
non-templated class String, you won't feel much of a pain in the first 
place because the enums will be converted to String objects upon call.

The String type solves all other problems mentioned.


More information about the Digitalmars-d mailing list