complement to $

Steven Schveighoffer schveiguy at yahoo.com
Fri May 14 19:09:26 PDT 2010


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?

>
>> 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 can make 0 work for LinkList and ArrayList, but not any of the others.   
Even with TreeSet, I allow using element values as slice arguments.

I guess I should have pointed this out in my first post... sorry.

-Steve


More information about the Digitalmars-d mailing list