On Thu, Mar 13, 2003 at 10:37:36PM -0600, david nicol wrote:
: 
: > > However, if you access the last element using the length of the array,
: > > it may try to flatten, and fail:
: > > 
: > >     my @flat = (1..Inf, 1..10);
: > >     $last = @[EMAIL PROTECTED] - 1];   # Kaboom!
: 
: How about negative indices?  We have negative indices in the slice()
: semantics; what if 
: 
:       $last = @array[-1]
: 
: always worked?

I don't see a problem with that.  That's why I specifically said
"using the length of the array".  The negative notation doesn't have
to use the length of the array.  It only has to know how to *find*
the end and count back from there.  It's an accident of implementation
if finding the end involves calculating the length.

Mind you, Perl 6.0.0 may well implement it that way accidentally, and
it wouldn't bother me a bit.  We can always relax the constraint later.

Larry

Reply via email to