Author: audreyt
Date: Sat Sep 30 20:16:38 2006
New Revision: 12533

Modified:
   doc/trunk/design/syn/S02.pod
   doc/trunk/design/syn/S09.pod

Log:
* S02: Re-introduce comprehension, this time not context-specific,
       under the list() syntactic expression:

    # list() comprehension that evaluates to (2,3,5)
    1 < list(1,1,2,3,5,8) < 8

* Also bump S09's version.
  

Modified: doc/trunk/design/syn/S02.pod
==============================================================================
--- doc/trunk/design/syn/S02.pod        (original)
+++ doc/trunk/design/syn/S02.pod        Sat Sep 30 20:16:38 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 26 Sept 2006
+  Last Modified: 1 Oct 2006
   Number: 2
-  Version: 73
+  Version: 74
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -2148,6 +2148,32 @@
 
 =item *
 
+When evaluating chained operators, if a C<list()> occurs anywhere in that
+chain, the chain will be transformed first into a C<grep>.  That is,
+
+    for 0 <= list(@x) < all(@y) {...}
+
+becomes
+
+    for @x.grep:{ 0 <= $_ < all(@y) } {...}
+
+Because of this, the original ordering C<@x> is guaranteed to be
+preserved in the returned list, and duplicate elements in C<@x> are
+preserved as well.  In particular,
+
+    @result = list(@x) ~~ {...};
+
+is equivalent to
+
+    @result = @x.grep:{...};
+
+However, this I<list() comprehension> is strictly a syntactic transformation,
+so a list computed any other way will not triger the rewrite:
+
+    @result = (@x = list(@y)) ~~ {...}; # not a comprehension
+
+=item *
+
 The C<|> prefix operator may be used to force "capture" context on its
 argument and I<also> defeat any scalar argument checking imposed by
 subroutine signature declarations.  Any resulting list arguments are

Modified: doc/trunk/design/syn/S09.pod
==============================================================================
--- doc/trunk/design/syn/S09.pod        (original)
+++ doc/trunk/design/syn/S09.pod        Sat Sep 30 20:16:38 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 13 Sep 2004
-  Last Modified: 13 Sept 2006
+  Last Modified: 1 Oct 2006
   Number: 9
-  Version: 14
+  Version: 15
 
 =head1 Overview
 

Reply via email to