yary wrote:
I'm a relative beginner at perl6, but pretty good with perl5 (and C
and a few others), so I read
"for 0...@foo.elems"
as saying "Give me a list with one item longer then @foo", not "give
me the indexes of @foo".
But a Perl non-beginner did make that mistake. The problem is that it
looks a lot like the Perl 5 "for my $k (0..$#foo)".
Anyways, I am not suggesting a change. I am pointing out a possible
confusion and letting the experts decide what to do.
for @foo.values -> $k { do_something($k,@foo[$k]) }
try @foo.keys instead!
Yeah... I noticed after I hit send.
Changing the meaning of "elems" to mean anything other then the number
of elements seems likely to cause even more confusion!
I did not say "let's change the meaning of 'elems'". I was very careful
to suggest nothing. I simply raised a point of confusion and I can prove
that it is a point of confusion because someone who does know about Perl
6 got confused. But what to do about it is something I leave to the experts.
Daniel.