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

Re: not 4,3,2,1,0;

Thread Previous | Thread Next
From:
Larry Wall
Date:
May 16, 2005 12:49
Subject:
Re: not 4,3,2,1,0;
Message ID:
20050516194913.GA9688@wall.org
On Tue, May 17, 2005 at 01:48:20AM +0800, Autrijus Tang wrote:
: This evaluates to 1 in Perl 5: 
: 
:     not 4,3,2,1,0;
: 
: Namely, the "not" listOp is taking the last of a variadic, non-slurpy
: argument list, boolify it, and return its negation.
: 
: What is the Perl 6 signature that correspond to this behaviour?

There is none.  Wherever Perl 5 defaults to "last of list", Perl
6 doesn't.  If you wanted to emulate it in user code, you'd have "is context(Scalar)" or some such and then explicitly ignore all
but the last value in your implementation.  But no built-ins rely on
C-comma behavior.

: Also, is this still sane for Perl 6's &not?

No.  In list context it should do !«[4,3,2,1,0].  In scalar context it
should probably return something like !any(4,3,2,1,0) or none(4,3,2,1,0)
or whatever we decide makes our collective brain hurt the least.

Larry

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