What if its a method of anything in an array?  $_ is already
a reference to the object on the array in for loops rather
than a copy of it.  What if we make change be not something about
for loops, but about anything in an array?

        print "The index, in its array, of <<$_>> is $CORE::ARRAY_INDEX{$_}"

where %CORE::ARRAY_INDEX is a very magical system-provided hash that
tells us the index in its array of something that is in an array.  It
is often undefined; and would get tricky but definable for objects that
can be in multiple containers at once, I'd think it would be the index
of the item in the most recent container it was accessed from.

If we are going to have arrays that can be sparse, we've pretty much got
to keep track of this info somehow anyway, so might as well give a way
to access it.



John McNamara wrote:

> 
> However, the abstraction breaks down as soon as you need to access the
> index as well as the variable. This can be seen in relation to iterating
> over an array of objects:

Reply via email to