Array Slice Ranges
BCS
BCS at pathlink.com
Thu Nov 9 10:23:58 PST 2006
Don Clugston wrote:
> rm wrote:
>
>>
>> well if compiler issues are no issues, than the most explicit would be:
>>
>> array[1 .. 5] == 1,2,3,4,5
>> array]1 .. 5] == 2,3,4,5
>> array[1 .. 5[ == 1,2,3,4
>> array]1 .. 5[ == 2,3,4
>>
>> roel
>
>
> so a[b[1..5].length]
>
> would become a[b]1..4[.length]
> ??
Nice one.
actually I think it would be
a[b]0..4[.length]
I think one big killer is that syntax highlighting would be darn near
impossible. Just try to get the brace matching working.
.--------------.
| .----. |
| | | |
a[b]0..4[.length]
same for the math version
.--------------.
| .----. |
| | | |
a[b[1..5).length]
[ matching ) ??
or what about eyeball parsing?
foo( a[i..2), fn(a2..i]);
what is that supposed to be?
it is darn close to:
foo( a[i..2]), fn(a[2..i]);
and both would compile.
More information about the Digitalmars-d
mailing list