Larry Wall skribis 2005-11-23 13:10 (-0800):
> : It seems strange to have a shortcut for 0..$n-1 but no shortcut for 0..$n.
> But then you'd usually want 1..$n instead...

I think this illustrates very well that it's a bit silly to have a
shortcut for just one of the three much-used ranges. My view is that
this shortcut hurts clarity. It's almost as if a purpose was sought for
the available ^, rather than there is something that will be used a lot,
that needs a shortcut.

Personally, I think even ^.., ^..^ and ..^ are too much, but that I can
live with.

> Couple reasons occur to me offhand.  First we're doing away with $#foo.

Yea, and there's @foo.last to replace it.

Indexes and numbers (counts) just aren't the same thing, and I think
source code should communicate meaning using the right words. The word
for "the last index" is .last, that of "the number of elements" is
.elems, or [EMAIL PROTECTED] If you need the last index, plus one, you shouldn't
use the number of elements, and if you need the number of elements,
minus one, you shouldn't use the last index. Am I the only one who cares
about this distinction?


Reply via email to