Author: larry
Date: Fri May 12 23:00:37 2006
New Revision: 9226


Capture explosions.

Modified: doc/trunk/design/syn/S02.pod
--- doc/trunk/design/syn/S02.pod        (original)
+++ doc/trunk/design/syn/S02.pod        Fri May 12 23:00:37 2006
@@ -1518,7 +1518,7 @@
 not be followed by any dereferencers, since you can always put them
 inside the closure.  The expression inside is evaluated in scalar
 (string) context.  You can force list context on the expression using
-either the C<list> operator if necessary.
+the C<list> operator if necessary.
 The following means the same as the previous example.

Modified: doc/trunk/design/syn/S03.pod
--- doc/trunk/design/syn/S03.pod        (original)
+++ doc/trunk/design/syn/S03.pod        Fri May 12 23:00:37 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 12 May 2006
   Number: 3
-  Version: 30
+  Version: 31
 =head1 Changes to existing operators
@@ -293,8 +293,16 @@
 of the object on the left.  The C<.^> operator calls a class metamethod;
 C<foo.^bar> is short for C<>.
-=item * Unary C<=> reads lines from a filehandle or filename, or in general
-iterates an iterator.
+=item * Unary C<=> reads lines from a filehandle or filename, or
+iterates an iterator, or in general causes a scalar to explode its guts
+when it would otherwise not.  How it does that is context senstive.
+For instance, C<=$iterator> is scalar/list sensitive and will
+produce one value in scalar context but many values in list context.
+(Use C<@$iterator> to force a fetch of all the values even in scalar
+context, and C<$$iterator> to force a fetch of a single value even
+in list context.)  On the other hand, C<=$capture> interpolates all
+parts of the capture that makes sense in the current list context,
+depending on what controls that list context.
@@ -487,6 +495,7 @@
     [||]()      # Bool::False
     [^^]()      # Bool::False
     [//]()      # undef
+    [=]()       # undef    (same for all assignment operators)
     [,]()       # ()
     [¥]()       # []
@@ -764,6 +773,24 @@
     push [,] func()
+Within the argument list of a C<[,]>, function return values are
+automatically exploded into their various parts, as if you'd said:
+    \$capture := func();
+    push [,] $$capture: @$capture, %$capture;
+or some such.  The C<[,]> then handles the various zones appropriately
+depending on the context.  An invocant only makes sense as the first
+argument to the outer function call.  An invocant inserted anywhere
+else just becomes a positional argument at the front of its list,
+as if its colon changed back to a comma.
+If you already have a capture variable, you can interpolated all of its
+bits at once using the C<< prefix:<=> >> operator.  The above is equivalent to
+    \$capture := func();
+    push [,] =$capture;
 =head1 Piping operators
 The new operators C<< ==> >> and C<< <== >> are akin to UNIX pipes, but

Modified: doc/trunk/design/syn/S04.pod
--- doc/trunk/design/syn/S04.pod        (original)
+++ doc/trunk/design/syn/S04.pod        Fri May 12 23:00:37 2006
@@ -757,7 +757,7 @@
     $_      $x        Type of Match Implied    Matching Code
     ======  =====     =====================    =============
-    Any     Code<$>   scalar sub truth         match if $x($_)
+    Any     Code:($)   scalar sub truth         match if $x($_)
     Hash    Hash      hash keys identical      match if $_.keys.sort »eq« 
     Hash    any(Hash) hash key intersection    match if $_{any(Hash.keys)}
     Hash    Array     hash value slice truth   match if $_{any(@$x)}
@@ -776,7 +776,7 @@
     Num     NumRange  in numeric range         match if $min <= $_ <= $max
     Str     StrRange  in string range          match if $min le $_ le $max
     Capture Signature parameter binding        match if $cap can bind to $sig
-    Any     Code<>    simple closure truth*    match if $x() (ignoring $_)
+    Any     Code:()    simple closure truth*    match if $x() (ignoring $_)
     Any     Class     class membership         match if $_.does($x)
     Any     Role      role playing             match if $_.does($x)
     Any     Num       numeric equality         match if $_ == $x

Reply via email to