Aaron Sherman <[EMAIL PROTECTED]> writes:
> On Sun, Dec 16, 2001 at 03:55:10PM +1100, Damian Conway wrote:
>
> [...]
>
>> > And, just for laughs:
>> >
>> > $ref = [1,2];
>> > @ary[$ref] = foo(); # probably a syntax error
>
> Ok, as far as I can recall, Larry hinted that arrays and references to
> arrays would be interchangable in many contexts in P6. In this case, I
> can't see any reason that subscripting would *want* to do a SvIV on
> a known reference, so I would expect it to obey that logic and treat
> the reference as an array. Thus, I expect this to be list context for
> the exact same reason that:
>
> @bar = (1,2);
> @ary[@bar] = foo();
>
> would be.
>
> Next question, though:
>
> $val = (foo())[0];
>
> List?
Scalar, obviously. With a possible runtime error if foo doesn't return
an arrayref. And that should probably written as:
$val = foo().[0]
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?