Array Slice Ranges
rm
roel.mathys at gmail.com
Thu Nov 9 06:32:23 PST 2006
Ary Manzana wrote:
> Mike Parker escribió:
>> Alexander Panek wrote:
>>> I'd really like to have a distinction between exclusive and inclusive
>>> slicing. Maybe '..'(inclusive) and '..-'(exclusive) or similar, with
>>> '..' => '..-'. Not *that* beautiful, though .. maybe someone has a
>>> better suggestion.
>>>
>>
>> What about leaving ... as is and using ..+, or ...+, for inclusive?
>
> I think the best approach is to use standard mathematical notation:
>
> 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
>
> There's no confusion there when you know mathematical ranges. The only
> problem is it's a confusion to the compiler... maybe?
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
More information about the Digitalmars-d
mailing list