On 2004-12-19 at 21:35:46, Luke Palmer wrote:
> In Perl 5 you can do the hackish:
>
> (\my @foo)->[23] = 42;
Hm. My reaction to the above is, and I think I speak for the entire
assemblage when I say this, "Yuckbo."
:)
Now, (my @foo)[23] would be somewhat better, but of course, that's
attempting to assign to an element of a nonce list, not an array.
I think it would be reasonable for { my @foo[23] = 42; } to be legal
Perl 6 that declares @foo as lexical. Letting { my $foo[23] = 42; }
work in Perl 5 would be weirder, but Perl6's "arrays always have @"
means that it's pretty clear you're declaring an array rather than a single
element.
Just my 2c.
-Mark