Author: larry
Date: Sat Apr 22 17:21:32 2006
New Revision: 8913

Modified:
   doc/trunk/design/syn/S03.pod
   doc/trunk/design/syn/S05.pod
   doc/trunk/design/syn/S06.pod
   doc/trunk/design/syn/S11.pod

Log:
Killed postfix ... dead.
Generalized "Whatever" from subscripts to any MMD op that accepts Whatever.


Modified: doc/trunk/design/syn/S03.pod
==============================================================================
--- doc/trunk/design/syn/S03.pod        (original)
+++ doc/trunk/design/syn/S03.pod        Sat Apr 22 17:21:32 2006
@@ -14,7 +14,7 @@
   Date: 8 Mar 2004
   Last Modified: 22 Apr 2006
   Number: 3
-  Version: 20
+  Version: 21
 
 =head1 Changes to existing operators
 
@@ -75,6 +75,11 @@
 even in scalar context.)  The C<ff> operator may take a caret on
 either end to exclude either the beginning or ending.  There is
 also a corresponding C<fff> operator with Perl 5's C<...> semantics.
+You may say
+
+    /foo/ ff *
+
+to indicate a flipflop that never flops once flipped.
 
 =item * All comparison operators are unified at the same precedence level.
 See Chained Comparisons below.
@@ -172,6 +177,23 @@
     1.5 ~~ 1^..^2  # true, equivalent to 1 < 1.5 < 2
     2.1 ~~ 1..2    # false, equivalent to 1 <= 2.1 <= 2
 
+If an argumentless C<*> (see the "Whatever" operator below) occurs on
+the right side of a range, it is taken to mean "positive infinity"
+in whatever space the range is operating.  A C<*> on the left means
+"negative infinity" for types that support negative values.  If the
+C<*> occurs on one side but not the other, the type is inferred from
+the other argument.  A star on both sides will match any value that
+supports the Ordered role.
+
+    0..*       # 0 .. +Inf
+    'a'..*     # 'a' .. 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
+    *..0       # -Inf .. 0
+    *..*       # "-Inf .. +Inf", really Ordered
+    1.2.3..*   # Any version higher than 1.2.3.
+
+Note: infinite lists are constructed lazily.  And even though C<*..*>
+can't be constructed at all, it's still useful as a selector object.
+
 =item * The unary C<^> operator generates a range from C<0> up to
 one less than its argument.  So C<^4> is short for C<0..^4> or C<0..3>.
 
@@ -185,13 +207,8 @@
 so C<^Moose> is short for C<Moose.meta>.  It still kinda means "what
 is this thing's domain" in an abstract sort of way.
 
-=item * C<...> where an operator is expected is either a unary postfix
-or an infix operator that takes no right argument.  It constructs a
-semi-infinite (and lazily evaluated) list, starting at the value of
-its single argument.
-
-=item * However, C<...> where a term is expected is the "yada,
-yada, yada" prefix operator, which is used as the body in function
+=item * The C<...> prefix operator is the
+"yada, yada, yada" operator, which is used as the body in function
 prototypes.  It complains bitterly (by calling C<fail>) if it is
 ever executed.  Variant C<???> calls C<warn>, and C<!!!> calls C<die>.
 The argument is optional, but if provided, is passed onto the C<warn>,
@@ -630,6 +647,41 @@
 
 You may use either of them on a scalar iterator to force it to iterate.
 
+=item * The "Whatever" operator
+
+If the C<*> prefix operator has I<no> argument, it captures the notion
+of "Whatever", which is applied lazily by whatever operator it is
+an argument to.  Generally it can just be thought of as a "glob"
+that gives you everything it can in that argument position.  For instance:
+
+    if $x ~~ 1..* {...}                        # if 1 <= $x <= +Inf
+    my ($a,$b,$c) = "foo" xx *;                # an arbitrary long list of 
"foo"
+    if /foo/ ff * {...}                        # a latching flipflop
+    @slice = @x[*;0;*];                        # any Int
+    %slice = %x{*;'foo'};              # any keys in domain of 1st dimension
+    %array[*]                          # *not* a zen slice
+
+C<Whatever> is an undefined prototype object derived from C<Any>.  As a
+type it is abstract, and may not be instantiated as a defined object.
+If for a particular MMD dispatch, nothing in the MMD system claims it,
+it dispatches to as an C<Any> with an undefined value, and usually
+blows up constructively.  If you say
+
+    say 1 + *;
+
+you should probably not expect it to yield a reasonable answer, unless
+you think an exception is reasonable.  Since the C<Whatever> object
+is effectively immutable, the optimizer is free to recognize bare C<*>
+and optimize in the context of what operator it is being passed to.
+
+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
+in a dwimmey way, not as a nihilistic "don't care anymore--just shoot me".
+Care must also be taken not to introduce it on the left side of an infix
+that would be misconstrued as a term or prefix.  C<*..*> works only because
+no term starts with "C<..>".
+
 =head1 Piping operators
 
 The new operators C<< ==> >> and C<< <== >> are akin to UNIX pipes, but

Modified: doc/trunk/design/syn/S05.pod
==============================================================================
--- doc/trunk/design/syn/S05.pod        (original)
+++ doc/trunk/design/syn/S05.pod        Sat Apr 22 17:21:32 2006
@@ -16,7 +16,7 @@
    Date: 24 Jun 2002
    Last Modified: 22 Apr 2006
    Number: 5
-   Version: 21
+   Version: 22
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I<regex> because they haven't been
@@ -463,7 +463,7 @@
 (At least, it fails in the absence of C<use rx :listquantifier>,
 which is likely to be unimplemented in Perl 6.0.0 anyway).
 
-The optimizer will likely optimize away things like C<**{1...}>
+The optimizer will likely optimize away things like C<**{1..*}>
 so that the closure is never actually run in that case.  But it's
 a closure that must be run in the general case, so you can use
 it to generate a range on the fly based on the earlier matching.
@@ -1682,7 +1682,7 @@
       # |   $0         $1        ||      |
       # |  _^_      ___^___      ||      |
       # | |   |    |       |     ||      |
-     m/ [ (\w+) \: (\w+ \h*)* \n ]**{2...} /
+     m/ [ (\w+) \: (\w+ \h*)* \n ]**{2..*} /
 
 Non-capturing brackets I<don't> create a separate nested lexical scope,
 so the two subpatterns inside them are actually still in the regex's
@@ -1700,7 +1700,7 @@
 
                #   $0--     $1------
                #   |   |    |       |
-     $text ~~ m/ [ (\w+) \: (\w+ \h*)* \n ]**{2...} /;
+     $text ~~ m/ [ (\w+) \: (\w+ \h*)* \n ]**{2..*} /;
 
      # Because they're in a quantified non-capturing block...
      # $0 contains the equivalent of:
@@ -1730,7 +1730,7 @@
                # |                        |
                # | $0[0]    $0[1]---      |
                # | |   |    |       |     |
-     $text ~~ m/ ( (\w+) \: (\w+ \h*)* \n )**{2...} /;
+     $text ~~ m/ ( (\w+) \: (\w+ \h*)* \n )**{2..*} /;
 
      # Because it's in a quantified capturing block,
      # $0 contains the equivalent of:

Modified: doc/trunk/design/syn/S06.pod
==============================================================================
--- doc/trunk/design/syn/S06.pod        (original)
+++ doc/trunk/design/syn/S06.pod        Sat Apr 22 17:21:32 2006
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 21 Apr 2006
+  Last Modified: 22 Apr 2006
   Number: 6
-  Version: 29
+  Version: 30
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -886,8 +886,8 @@
 the "pipe" twigil marks a multidimensional array, that is, an
 array of slices.
 
-    0...       ==> @@foo;
-    'a'...     ==> @@foo;
+    0..*       ==> @@foo;
+    'a'..*     ==> @@foo;
     pidigits() ==> @@foo;
 
     for zip(@@foo) { say }
@@ -911,12 +911,12 @@
 A semicolon inside brackets is equivalent to stacked pipes.  The code above
 could be rewritten as:
 
-    (0...; 'a'...; pidigits()) ==> my @@foo;
+    (0..*; 'a'..*; pidigits()) ==> my @@foo;
     for @@foo.zip { say }
 
 which is in turn equivalent to
 
-    for zip(0...; 'a'...; pidigits()) { say }
+    for zip(0..*; 'a'..*; pidigits()) { say }
 
 A named receiver array is useful when you wish to pipe into an
 expression that is not an ordinary list operator, and you wish to be
@@ -962,8 +962,8 @@
 as the default receiver.  So instead of using C<@@foo> above you can
 just say
 
-    0...       ==> ;
-    'a'...     ==> ;
+    0..*       ==> ;
+    'a'..*     ==> ;
     pidigits() ==> ;
 
     # outputs "(0, 'a', 3)\n"...
@@ -978,38 +978,38 @@
 
 So
 
-    ('a'...; 0...) ==> ;
+    ('a'..*; 0..*) ==> ;
      for zip(@@_ <== @foo) -> [$a, $i, $x] { ...}
 
 is the same as
 
-    'a'... ==> ;
-     0...  ==> ;
+    'a'..* ==> ;
+     0..*  ==> ;
      for zip(@@_ <== @foo) -> [$a, $i, $x] { ...}
 
 which is the same as
 
-    for zip('a'...; 0...; @foo) -> [$a, $i, $x] { ...}
+    for zip('a'..*; 0..*; @foo) -> [$a, $i, $x] { ...}
 
 And
 
     @foo ==> ;
-    0... ==> ;
+    0..* ==> ;
     for each(@@_) -> $x, $i { ...}
 
 is the same as
 
-    0... ==> ;
+    0..* ==> ;
     for each(@foo; @@_) -> $x, $i { ...}
 
 which is the same as
 
-    for each(@foo; 0...) -> $x, $i { ...}
+    for each(@foo; 0..*) -> $x, $i { ...}
 
 Note that the each method is also sensitive to multislicing, so you
 could also just write that as:
 
-    (@foo; 0...).each: -> $x, $i { ...}
+    (@foo; 0..*).each: -> $x, $i { ...}
 
 Also note that these come out to identical for ordinary arrays:
 

Modified: doc/trunk/design/syn/S11.pod
==============================================================================
--- doc/trunk/design/syn/S11.pod        (original)
+++ doc/trunk/design/syn/S11.pod        Sat Apr 22 17:21:32 2006
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 1 Apr 2006
+  Last Modified: 22 Apr 2006
   Number: 11
-  Version: 11
+  Version: 12
 
 =head1 Overview
 
@@ -241,9 +241,9 @@
 
     use Dog-(1.2.1..1.2.3);
     use Dog-(1.2.1..^1.3);
-    use Dog-(1.2.1...);
+    use Dog-(1.2.1..*);
 
-Subversions are wildcarded, so C<1.2> really means C<1.2.0...>.  If you
+Subversions are wildcarded, so C<1.2> really means C<1.2.*>.  If you
 say:
 
     use v6;
@@ -320,7 +320,7 @@
 
 Those all specify the latest Perl 6 semantics, and are equivalent to
 
-    use Perl-(v6.0...)-(Any);
+    use Perl-(v6..*)-(Any);
 
 To lock the semantics to 6.0.0, say:
 

Reply via email to