Array Slice Ranges

Alexander Panek a.panek at brainsware.org
Wed Nov 8 21:22:22 PST 2006


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.

Alex


Walter Bright wrote:
> %u wrote:
>> I'm learning ruby right now, and I noticed they use a very cool syntax 
>> for ranges.
>>
>> 0..5 means 0, 1, 2, 3, 4, 5
>> 0...5 means 0, 1, 2, 3, 4
>>
>> The current array slicing is useful half the time and a pain in the 
>> arse the
>> other half, so I was wondering if anyone else has mentioned this idea 
>> for D
>> before...
> 
> I have a bit of a problem with .. vs ..., I think they both look too 
> similar  making it hard to review code for correctness, and I'd have a 
> hard time remembering which means which, another source of bugs.



More information about the Digitalmars-d mailing list