Author: larry Date: Sun May 14 10:39:58 2006 New Revision: 9253 Modified: doc/trunk/design/syn/S02.pod doc/trunk/design/syn/S06.pod
Log: Got rid of default @@_ array and postfix ==>. May now pipe to * multiple times. Pipe batches sent to * are received with *** now. (*** also specifies receiver location for current pointy end.) Modified: doc/trunk/design/syn/S02.pod ============================================================================== --- doc/trunk/design/syn/S02.pod (original) +++ doc/trunk/design/syn/S02.pod Sun May 14 10:39:58 2006 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 10 Aug 2004 - Last Modified: 12 May 2006 + Last Modified: 14 May 2006 Number: 2 - Version: 40 + Version: 41 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -506,6 +506,12 @@ is effectively immutable, the optimizer is free to recognize C<*> and optimize in the context of what operator it is being passed to. +A variant of C<*> is the C<**> term. It is generally understood to +be a multidimension form of C<*> when that makes sense. + +The C<***> variant serves as the insertion point of a list of pipes. +That insertion point may be targeted by piping to C<*>. See S06. + Other uses for C<*> will doubtless suggest themselves over time. These can be given meaning via the MMD system, if not the compiler. In general a C<Whatever> should be interpreted as maximizing the degrees of freedom Modified: doc/trunk/design/syn/S06.pod ============================================================================== --- doc/trunk/design/syn/S06.pod (original) +++ doc/trunk/design/syn/S06.pod Sun May 14 10:39:58 2006 @@ -13,9 +13,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 21 Mar 2003 - Last Modified: 13 May 2006 + Last Modified: 14 May 2006 Number: 6 - Version: 34 + Version: 35 This document summarizes Apocalypse 6, which covers subroutines and the @@ -860,6 +860,25 @@ operation, it must be something else that can be interpreted as a list receiver. +Any list operator is considered a variadic operation, so ordinarily +a list operator adds any piped input to the end of its list. +But sometimes you want to interpolate elsewhere, so the C<***> term +may be used to indicating the target of a pipe without the use of a +temporary array: + + foo() ==> say ***, " is what I meant"; + bar() ==> ***.baz(); + +Piping to the C<*> "whatever" term is considered a pipe to the lexically +following C<***> term: + + 0..* ==> *; + 'a'..* ==> *; + pidigits() ==> *; + + # outputs "(0, 'a', 3)\n"... + for zip(***) { .perl.say } + You may use a variable (or variable declaration) as a receiver, in which case the list value is bound as the "todo" of the variable. Do not think of it as an assignment, nor as an ordinary binding. @@ -979,19 +998,8 @@ In particular, you can use C<@@foo> to interpolate a multidimensional slice in an array or hash subscript. -Every lexical scope can use its own implicitly declared C<@_> variable -as the default receiver. So instead of using C<@@foo> above you can -just say - - 0..* ==> ; - 'a'..* ==> ; - pidigits() ==> ; - - # outputs "(0, 'a', 3)\n"... - for zip(@@_) { .perl.say } - -If C<@@_> is currently empty, then C<for zip(@@_) {...}> would act on a -zero-dimensional slice (i.e. C<for (zip) {...}>), and output nothing +If C<@@foo> is currently empty, then C<for zip(@@foo) {...}> acts on a +zero-dimensional slice (i.e. C<for (zip) {...}>), and outputs nothing at all. Note that with the current definition, the order of pipes is preserved @@ -999,14 +1007,14 @@ So - ('a'..*; 0..*) ==> ; - for zip(@@_ <== @foo) -> [$a, $i, $x] { ...} + ('a'..*; 0..*) ==> *; + for zip(*** <== @foo) -> [$a, $i, $x] { ...} is the same as - 'a'..* ==> ; - 0..* ==> ; - for zip(@@_ <== @foo) -> [$a, $i, $x] { ...} + 'a'..* ==> *; + 0..* ==> *; + for zip(*** <== @foo) -> [$a, $i, $x] { ...} which is the same as @@ -1014,14 +1022,14 @@ And - @foo ==> ; - 0..* ==> ; - for each(@@_) -> $x, $i { ...} + @foo ==> *; + 0..* ==> *; + for each(***) -> $x, $i { ...} is the same as - 0..* ==> ; - for each(@foo; @@_) -> $x, $i { ...} + 0..* ==> *; + for each(@foo; ***) -> $x, $i { ...} which is the same as