Skip to content

Commit

Permalink
[S06] spec the \| parcel parameter syntax
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@30128 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
lwall committed Mar 19, 2010
1 parent bf148a8 commit 11fe4fc
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions S06-routines.pod
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Synopsis 6: Subroutines

Created: 21 Mar 2003

Last Modified: 7 Mar 2010
Version: 129
Last Modified: 19 Mar 2010
Version: 130

This document summarizes Apocalypse 6, which covers subroutines and the
new type system.
Expand Down Expand Up @@ -661,7 +661,7 @@ parameter is declared with the name C<$_>. A method's invocant
always has the alias C<self>. Other styles of self can be declared
with the C<self> pragma.

If you have call of the form:
If you have a call of the form:

foo(|$capture)

Expand Down Expand Up @@ -939,6 +939,20 @@ what signature to match against.
multi foo (|$args (Int, Bool?, *@, *%)) { reallyintfoo($args) }
multi foo (|$args (Str, Bool?, *@, *%)) { reallystrfoo($args) }

=head2 Parcel binding

It is possible to bind the argument list in an even more raw form
as a C<Parcel> object. A signature to capture the parcel must be
declared as:

sub foo (\|$parcel) { ... }

This single parcel parameter is the only thing allowed in such a signature
(apart from a return type). An implementation must either be able to
reconstruct the original parcel object from a capture, or the compiler
must be smart enough to know when to save the original parcel object
based on proto declarations and/or call indirection.

=head2 Flattening argument lists

The unary C<|> operator casts its argument to a C<Capture>
Expand Down

0 comments on commit 11fe4fc

Please sign in to comment.