On Friday, 20 September 2013 at 16:38:29 UTC, Andrei Alexandrescu
wrote:
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.
What is even the purpose of const ranges? It makes little sense
imho. Why would GoF iterator be immutable? It is like trying to
iterate over collection bu indexing but only having const int as
index variable. If anything it only make sense to have ranges to
const (abstraction over const_iterator).