Bartosz Milewski seems to like D more than C++ now :)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Sep 20 09:38:29 PDT 2013


On 9/20/13 8:13 AM, Joseph Rushton Wakeling wrote:
> On 20/09/13 16:48, H. S. Teoh wrote:
>> A container should not be confused with a range. That way leads to
>> dragons. :-P  (It's rather unfortunate that built-in arrays conflate the
>> two, it leads to a lot of wrong code that works only with arrays but not
>> with "real" ranges.)
>
> Built-in arrays are not _always_ ranges.  Consider const(int[]) ... as I
> found out recently, it's _not_ a range, because you can't popFront on a
> const entity.
>

Well you can't call popFront on any const range.

After some time I learned to make peace with the dual nature of built-in 
slices. Part of that was the failed experiment to introduce the type 
"new T[]". Another part is the simple realization that built-in slices 
are not "regular" ranges, they have deeper connections in D's object 
model, so they're allowed to be a little special.


Andrei



More information about the Digitalmars-d mailing list