www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Range Type

Janice Caron Wrote:

 On 24/03/2008, sambeau <sambeau-nospam mac.com> wrote:

 You may perhaps have misunderstood the proposal. The type T..U is
 sugar for struct { T begin; U end; }, that's all. The value x..y is
 just an instance of typeof(x)..typeof(y). There's no array magic going
 on whatsover. You'd use ranges to /slice/ arrays, that's all.

Yes, I was clearly miles away and grabbing the short end of the stick. I had just been reading your other thread about constness and thought you had come up with something more ambitous (that matched something going on in my head while reading it) - namely how can you express a subset of a const collection while informing the compiler that as it is a subset it must share it's super-sets constness.
  And now I need to think whether ranges are the only interesting exceptions to
const that we need to consider.

It's not an exception to const.

My apologies. "Exception" was probably a hasty term. I was considering, following on from this (above) that if you could declare one const collection to be a subset of another (and thus retain its constant nature) could you make a superset of a number of const collections and retain the constness, too. That was all. And I'm still mulling it over :-)
Mar 24 2008