Range Type

Craig Black cblack at ara.com
Mon Mar 24 09:06:55 PDT 2008


"Janice Caron" <caron800 at googlemail.com> wrote in message 
news:mailman.201.1206373241.2351.digitalmars-d at puremagic.com...
> On 24/03/2008, Craig Black <cblack at ara.com> wrote:
>> Why not just leave out the second type and save some typing?
>>
>>  int.. x;
>
> That would make "a..b" semantically ambiguous - is "a.." a type and
> "b" a value, or is "a..b" an expression?
>
> We need to keep D's grammar context free.

I could be wrong, but I don't think this would be a big deal.  The .. would 
be interpreted differently when preceded by a type.  The .. would work like 
[].

int.. x;   // A range of integers
int[] x;  // An array of integers 





More information about the Digitalmars-d mailing list