Dave Whipp dave-at-whipp.name |Perl 6| wrote:


Does perl6 still have some implicit mechanism to say "call sub using current arglist"?

(No, I'm not arguing to support any of this: just asking the questions)


Yes. You can use 'callsame' and it knows the current argument list. You can get at it explicitly if you declare it like this:

  sub foo (|$arglist) { ...

Now $arglist is an object of type Capture, which would be getting into a lot more than a simple reply. It's not just a simple @_ array, but handles named, optional, slice, etc.
"

=head2 Argument list binding

The underlying C<Capture> object may be bound to a single scalar
parameter marked with a C<|>.

   sub bar ($a,$b,$c,:$mice) { say $mice }
   sub foo (|$args) { say $args.perl; &bar.callwith(|$args); }

This prints:

   foo 1,2,3,:mice<blind>;     # says "\(1,2,3,:mice<blind>)" then "blind"

"


See http://svn.perl.org/perl6/doc/trunk/design/syn/S06.pod
for more information.

Reply via email to