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

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

Thread Previous | Thread Next
Larry Wall
May 16, 2005 12:49
Re: not 4,3,2,1,0;
Message ID:
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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About