complement to $

KennyTM~ kennytm at gmail.com
Fri May 14 23:43:17 PDT 2010


On May 15, 10 13:07, Walter Bright wrote:
> Steven Schveighoffer wrote:
>> On Fri, 14 May 2010 13:33:57 -0400, Walter Bright
>> <newshound1 at digitalmars.com> wrote:
>>
>>> Steven Schveighoffer wrote:
>>>> So how does this look: coll[^..$];
>>>
>>> nooooooooo <g>
>>
>> Do you have specific objections, or does it just look horrendous to
>> you :) Would another symbol be acceptable?
>
>
> The problem is D already has a lot of syntax. More syntax just makes the
> language more burdensome after a certain point, even if in isolation
> it's a good idea.
>
> One particular problem regex has is that few can remember its syntax
> unless they use it every day.
>
>
>>>> Thoughts? other ideas?
>>>
>>> I'd just go with accepting the literal 0. Let's see how far that goes
>>> first.
>>
>> I thought of a counter case:
>>
>> auto tm = new TreeMap!(int, uint);
>> tm[-1] = 5;
>> tm[1] = 6;
>>
>> What does tm[0..$] mean? What about tm[0]? If it is analogous to
>> "beginning of collection" then it doesn't make any sense for a
>> container with a key of numeric type.
>>
>> Actually any map type where the indexes don't *always* start at zero
>> are a problem.
>
> I'd question the design of a map type that has the start at something
> other than 0.

Why a map type (sorted associative array)'s key must start at zero?


More information about the Digitalmars-d mailing list