Bart Lateur writes:
: Because you might have a wantarray situation that expects no values?
:
: () =3D whateveryouwant();
:
: You can always expect one more than is on the LHS.
:
: How is this currently handled with split()?
It fakes up a third argument that is one more than the length of the
list.
In Perl 6, we'll have a unary * that (in an lvalue or formal parameter)
marks the following item as a "slurper". So in a list assignment,
these work differently:
(@a, @b, @c) = ...; # provides 3 scalar contexts
(@a, @b, *@c) = ...; # provides 2 scalar and 1 list context
So by analogy, we could conceivably have:
($a, $b, $c) = split; # splits in 3 spots
($a, $b, *$rest) = split; # splits in 2 spots
But what that would mean in a formal parameter list, I have no idea.
So * on a scalar might not fly in general.
A unary * in rvalue context defeats signature checking for the rest
of the arguments in the list. So Perl 5's:
&foo(@list)
would likely be translated to Perl 6's:
foo(*@list)
Larry
- Re: Please make "last" work in "grep"... Larry Wall
- Re: Please make "last" work in "grep"... Michael G Schwern
- Re: Please make "last" work in "grep"... Graham Barr
- Re: Please make "last" work in "grep"... Uri Guttman
- Re: Please make "last" work in "grep"... Graham Barr
- Re: Please make "last" work in "grep... David L. Nicol
- Re: Please make "last" work in "grep"... H . Merijn Brand
- Re: Please make "last" work in "grep"... Michael G Schwern
- Re: Please make "last" work in "grep... John Porter
- Re: Please make "last" work in "grep"... Bart Lateur
- Re: Please make "last" work in "grep... Larry Wall
- Re: Please make "last" work in "grep... Damian Conway
- Re: Please make "last" work in "grep"... Larry Wall
- Re: Please make "last" work in "grep"... Graham Barr
- Re: Please make "last" work in "grep"... Jarkko Hietaniemi
- Re: Please make "last" work in "grep... Bart Lateur
- Re: Please make "last" work in "grep"... Dan Sugalski
- Re: Please make "last" work in "grep"... Larry Wall
- Re: Please make "last" work in "grep... Dan Sugalski
- Re: Please make "last" work in "grep"... Damian Conway
- Re: Please make "last" work in "grep... Dan Sugalski
