No we should not support enum types derived from strings

Paul Backus snarwin at gmail.com
Wed May 12 15:08:46 UTC 2021


On Wednesday, 12 May 2021 at 14:49:35 UTC, NonNull wrote:
> On Friday, 7 May 2021 at 20:53:08 UTC, Andrei Alexandrescu
>> Yah, ranges are a generalization of arrays. It would be odd if 
>> the generalization of arrays didn't work when tried with 
>> arrays.
>
> No. Ranges are not a generalization of arrays unless you ignore 
> the most important feature of the notion of a Range. An array 
> is a sequence of things in space: a spatial container (all 
> values stored) that happens to be a sequence. A Range is a 
> sequence of things in time. (Purist definition, often true in 
> practice.)

Ranges are a generalization of arrays (or slices, if you prefer) 
in the same way that iterators are a generalization of pointers. 
In both cases, certain features of the specialized version are 
ignored or left out in the generalized version. As you've 
correctly pointed out, one of those ignored features is the 
array's layout in memory. A range *may* store all of its elements 
in memory, or it may not; as users of the range API, we are not 
suppose to know or care.


More information about the Digitalmars-d mailing list