No we should not support enum types derived from strings

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri May 7 20:53:08 UTC 2021


On 5/7/21 2:44 PM, Steven Schveighoffer wrote:
> On 5/7/21 2:17 PM, Adam D. Ruppe wrote:
>> I think it was actually a mistake for Phobos to UFCS shoe-horn in 
>> range functions on arrays too - this includes strings as well as int[] 
>> and such as well.
> 
> The most common range BY FAR in all of D code is an array.
> 
> The end result of something like you allude to would result in nearly 
> all of phobos NOT working with arrays.
> 
> Just a taste:
> 
> int[] arr = genArray;
> arr.sort(); // fail.
> 
> I don't want to go to that place, ever.
> 
> -Steve

Yah, ranges are a generalization of arrays. It would be odd if the 
generalization of arrays didn't work when tried with arrays.


More information about the Digitalmars-d mailing list