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 06:37
Subject:
Re: Quickcheck of context of index expressions
Message ID:
20050429133730.GA61902@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.

I think allowing unknown LHS index expression to default to 
scalar context is a bit more useful here.  Since we have:

    @x[0]  = @y;	# scalar
    @x[0,] = @y;	# list

This may be more intuitive:

    @x[idx()]  = @y;	# scalar
    @x[idx(),] = @y;	# list

Than this:

    @x[+idx()] = @y;	# scalar
    @x[idx()]  = @y;	# list

But I don't really feel strongly one way or another, as long
as it is specced down. :)

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