On Tue, Aug 29, 2000 at 05:51:44PM -0500, David L. Nicol wrote:
> I'd like to see a last-container-key attribute included as
> a possibilty; and that attribute called ":n" to match the
> argument of integer functions in introductory algebra.  This
> approach gives us
> 
>       for $a @some_list {
>               print "$a is located at position ${a:n}\n";
>       };
> 
> The only response I received after suggesting it was that the
> attribute might be better called ":i" for index.
> 
> By tieing the count accessor to the particular variable, problems
> with scope in nested loops quite disappear.
> 
> The attribute also becomes available in "lazy arrays" and other
> functions trying to pass themselves off as arrays, syntactically.

Interesting.  I must have missed this.  I'm not wild about the syntax,
but I like the idea.  If everything become objects under-the-hood,
then we could have:

        for $a (@array) { print "$a is at $a->index\n"; }

No, I'm not wild about that either, but it's an idea.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to