opDollar

Stewart Gordon smjg_1998 at yahoo.com
Thu Sep 11 18:32:39 PDT 2008


"Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message 
news:gabkfm$2q5j$1 at digitalmars.com...
> "Tomas Lindquist Olsen" wrote
<snip>
>> Since $ is used as a shortcut for for array.length, I'd say opLength is a 
>> better choice. Maybe I missed some of the discussion ...
>
> I'd agree with opEnd.  opLength is only a valid construct for arrays, 
> where the slice indexes are based on how far into the container the 
> element is.
<snip>

Moreover, 'end' and 'length' correspond only in the case of _zero-based_ 
arrays.  If you create a class that implements 10-based arrays, you'll more 
likely want this notation for the end of the array than for the element 
that's 10 away from the end.

You could even invent signed-index arrays - maybe there's a use for indexes 
ranging from -16 to 15 inclusive, IWC -$ would signify the beginning.

Stewart.

-- 
My e-mail address is valid but not my primary mailbox.  Please keep replies 
on the 'group where everybody may benefit. 



More information about the Digitalmars-d-announce mailing list