develooper Front page | perl.perl6.language | Postings from April 2005

Re: Quickcheck of context of index expressions

Thread Previous | Thread Next
From:
Autrijus Tang
Date:
April 29, 2005 08:20
Subject:
Re: Quickcheck of context of index expressions
Message ID:
20050429152052.GA63159@aut.dyndns.org
On Fri, Apr 29, 2005 at 06:22:57AM -0700, Larry Wall wrote:
> :     @x[want()] = $_;  # scalar context
> :     @x[want()] = @_;  # scalar context
> 
> Maybe "unknown" context, which defaults to list.
> 
> :     @x[0,] = want();  # list context
> :     @x[want(),] = $_; # list context
> :     @x[want(),] = @_; # list context
> :     $_ = @x[want()];  # scalar context
> :     @_ = @x[want()];  # list context
> 
> No, I think they're all list context.

Okay. r2478 has them reverted to the original form, which
inspects the declared return type of want() to see if it is a subtype
of Scalar; if it is, then it is taken as scalar context;
otherwise (or if multiple multisubs are possible), it defaults
to list context.

Thanks,
/Autrijus/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About