Author: larry
Date: Fri Apr 21 18:01:04 2006
New Revision: 8905

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

Log:
Decided @; made more sense as a double @@ sigil than a twigil.
Unified @@x with @x so you can say sub foo { @@_ } usefully.
Default pipe receiver is now just @@_/@_.
Various other minor cleanups.


Modified: doc/trunk/design/syn/S02.pod
==============================================================================
--- doc/trunk/design/syn/S02.pod        (original)
+++ doc/trunk/design/syn/S02.pod        Fri Apr 21 18:01:04 2006
@@ -14,7 +14,7 @@
   Date: 10 Aug 2004
   Last Modified: 21 Apr 2006
   Number: 2
-  Version: 26
+  Version: 27
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -427,6 +427,7 @@
     %   unordered hash (associative array)
     &   code
     ::  package/module/class/role/subset/enum/type
+    @@  multislice view of @
 
 Within a declaration, the C<&> sigil also declares the visibility of the
 subroutine name without the sigil within the scope of the declaration.
@@ -464,7 +465,6 @@
     $=foo       pod variable
     $<foo>      match variable, short for $/{'foo'}
     $!foo       explicitly private attribute (mapped to $foo though)
-    @;foo       multislice
 
 Most variables with twigils are implicitly declared or assumed to
 be declared in some other scope, and don't need a "my" or "our".
@@ -1402,7 +1402,7 @@
 
     qq:c(0) "Here are { $two uninterpolated } curlies";
 
-or eqivalently:
+or equivalently:
 
     qq:!c "Here are { $two uninterpolated } curlies";
 

Modified: doc/trunk/design/syn/S05.pod
==============================================================================
--- doc/trunk/design/syn/S05.pod        (original)
+++ doc/trunk/design/syn/S05.pod        Fri Apr 21 18:01:04 2006
@@ -14,9 +14,9 @@
    Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
                Larry Wall <[EMAIL PROTECTED]>
    Date: 24 Jun 2002
-   Last Modified: 20 Apr 2006
+   Last Modified: 21 Apr 2006
    Number: 5
-   Version: 18
+   Version: 19
 
 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
@@ -31,8 +31,8 @@
 it doesn't look like it.  The individual capture variables (such as C<$0>,
 C<$1>, etc.) are just elements of C<$/>.
 
-By the way, the numbered capture variables now start at C<$0> rather than
-C<$1>.  See below.
+By the way, unlike in Perl 5, the numbered capture variables now
+start at C<$0> instead of C<$1>.  See below.
 
 =head1 Unchanged syntactic features
 
@@ -243,7 +243,7 @@
      $str = "abracadabra";
 
      if $str ~~ m:overlap/ a (.*) a / {
-         @substrings = @;();    # bracadabr cadabr dabr br
+         @substrings = @@();    # bracadabr cadabr dabr br
      }
 
 =item *
@@ -415,7 +415,7 @@
 =item *
 
 C<(...)> still delimits a capturing group. However the ordering of these
-groups is hierarchical, rather than linear. See L<Nested subpattern captures>.
+groups is hierarchical rather than linear. See L<Nested subpattern captures>.
 
 =item *
 
@@ -502,7 +502,7 @@
 
      / \Q$var\E /
 
-However, if C<$var> contains a Regex object, rather attempting to
+However, if C<$var> contains a Regex object, instead of attempting to
 convert it to a string, it is called as a subrule, as if you said
 C<< <$var> >>.  (See assertions below.)  This form does not capture,
 and it fails if C<$var> is tainted.
@@ -642,7 +642,7 @@
 
 A leading C<@> matches like a bare array except that each element is
 treated as a subrule (string or Regex object) rather than as a literal.
-That is, a string is forced to be compiled as a subrule rather than
+That is, a string is forced to be compiled as a subrule instead of being
 matched literally.  (There is no difference for a Regex object.)
 
 By default C<< <@foo> >> is captured into C<< $<foo> >>, but you can
@@ -978,7 +978,7 @@
 =item *
 
 Just as a raw C<{...}> is now always a closure (which may still
-execute immediately in certain contexts and be passed as a reference
+execute immediately in certain contexts and be passed as an object
 in others), so too a raw C</.../> is now always a Regex object (which
 may still match immediately in certain contexts and be passed as an
 object in others).
@@ -1025,7 +1025,7 @@
      }
 
 Using C<{...}> or C</.../> in the scalar context of the first argument
-causes it to produce a C<Code> or C<Rule> reference, which the switch
+causes it to produce a C<Code> or C<Rule> object, which the switch
 statement then selects upon.
 
 =item *
@@ -1634,8 +1634,7 @@
 
 Because a quantified subpattern returns a list of C<Match> objects, the
 corresponding array element for the quantified capture will store a
-reference to a (nested) array, rather than a single C<Match> object.
-For example:
+(nested) array rather than a single C<Match> object.  For example:
 
      if m/ (\w+) \: (\w+ \s+)* / {
          say "Key:    $0";         # Unquantified --> single Match
@@ -1669,7 +1668,7 @@
 =item *
 
 However, because the two subpatterns are inside a quantified
-structure, C<$0> and C<$1> will each contain a reference to an array.
+structure, C<$0> and C<$1> will each contain an array.
 The elements of that array will be the submatches returned by the
 corresponding subpattern on each iteration of the non-capturing
 parentheses. For example:
@@ -1764,7 +1763,7 @@
                   /;
 
 This means that if the second alternation matches, the C<@$/> array will
-contain C<('every', 'green', 'BEM', 'devours', 'faces')>, rather than
+contain C<('every', 'green', 'BEM', 'devours', 'faces')> rather than
 C<(undef, undef, undef, undef, undef, undef, 'every', 'green', 'BEM',
 'devours', 'faces')> (as the same regex would in Perl 5).
 
@@ -1854,8 +1853,8 @@
 If a subrule appears two (or more) times in any branch of a lexical
 scope (i.e. twice within the same subpattern and alternation), or if the
 subrule is quantified anywhere within a given scope, then its
-corresponding hash entry is always assigned a reference to an array of
-C<Match> objects, rather than a single C<Match> object.
+corresponding hash entry is always assigned an array of
+C<Match> objects rather than a single C<Match> object.
 
 =item *
 
@@ -2082,7 +2081,7 @@
 
 the behavior is exactly the same as for a named alias (i.e the various
 cases described above), except that the resulting C<Match> object is
-assigned to the corresponding element of the appropriate array, rather
+assigned to the corresponding element of the appropriate array rather
 than to an element of the hash.
 
 =item *
@@ -2161,7 +2160,7 @@
 list of C<Match> objects (as described in L<Quantified subpattern
 captures> and L<Repeated captures of the same subrule>).
 So the corresponding array element or hash entry for the alias will
-contain a reference to an array, instead of a single C<Match> object.
+contain an array, instead of a single C<Match> object.
 
 =item *
 
@@ -2170,7 +2169,7 @@
 
      if m/ mv $0:=<file>+ / {
          # <file>+ returns a list of Match objects,
-         # so $0 contains a reference to an array of Match objects,
+         # so $0 contains an array of Match objects,
          # one for each successful call to <file>
 
          # $/<file> does not exist (it's pre-empted by the alias)
@@ -2179,7 +2178,7 @@
 
      if m/ mv $<from>:=(\S+ \s+)* / {
          # Quantified subpattern returns a list of Match objects,
-         # so $/<from> contains a reference to an array of Match
+         # so $/<from> contains an array of Match
          # objects, one for each successful match of the subpattern
 
          # $0 does not exist (it's pre-empted by the alias)
@@ -2215,7 +2214,7 @@
 
 Using the C<< @<alias>:= >> notation instead of a C<< $<alias>:= >>
 mandates that the corresponding hash entry or array element I<always>
-receives a reference to an array of C<Match> objects, even if the
+receives an array of C<Match> objects, even if the
 construct being aliased would normally return a single C<Match> object.
 This is useful for creating consistent capture semantics across
 structurally different alternations (by enforcing array captures in all
@@ -2337,7 +2336,7 @@
 It is also possible to use a numbered variable as an array alias.
 The semantics are exactly as described above, with the sole difference
 being that the resulting array of C<Match> objects is assigned into the
-appropriate element of the regex's match array, rather than to a key of
+appropriate element of the regex's match array rather than to a key of
 its match hash. For example:
 
      if m/ mv  \s+  @0:=((\w+) \s+)+  $1:=((\W+) (\s*))* / {
@@ -2382,7 +2381,7 @@
 
 A hash alias causes the corresponding hash or array element in the
 current scope's C<Match> object to be assigned a (nested) Hash object
-(rather than an Array object or a single C<Match> object).
+(rather than an C<Array> object or a single C<Match> object).
 
 =item *
 
@@ -2401,7 +2400,7 @@
      if m:w/ %0:=<one_to_many>+ / {
          # $/[0] contains a hash, in which each key is provided by
          # the first subcapture within C<one_to_many>, and each
-         # value is a reference to an  array containing the
+         # value is an  array containing the
          # subrule's second, third, and fourth, etc. subcaptures...
 
          for %{$/[0]} -> $pair {
@@ -2482,8 +2481,8 @@
 Subcaptures are returned as a multidimensional list, which the user can
 choose to process in either of two ways.  If you refer to
 C<@()>, the multidimensionality is ignored and all the matches are returned
-flattened (but still lazily).  If you refer to @;(), you can
-get each individual sublist as a Capture object. (That is, there is a C<@;()>
+flattened (but still lazily).  If you refer to @@(), you can
+get each individual sublist as a Capture object. (That is, there is a C<@@()>
 coercion operator that happens, like C<@()>, to default to C<$/>.)
 As with any multidimensional list, each sublist can be lazy separately.
 
@@ -2499,9 +2498,9 @@
 match is also available:
 
      if $text ~~ m:w:g/ (\S+:) <rocks> / {
-         say "Matched { +@;() } times";    # Note: forced eager here
+         say "Matched { +@@() } times";    # Note: forced eager here
 
-         for @;() -> $m {
+         for @@() -> $m {
              say "Match between $m.from() and $m.to()";
              say 'Right on, dude!' if $m[0] eq 'Perl';
              say "Rocks like $m<rocks>";

Modified: doc/trunk/design/syn/S06.pod
==============================================================================
--- doc/trunk/design/syn/S06.pod        (original)
+++ doc/trunk/design/syn/S06.pod        Fri Apr 21 18:01:04 2006
@@ -15,7 +15,7 @@
   Date: 21 Mar 2003
   Last Modified: 21 Apr 2006
   Number: 6
-  Version: 27
+  Version: 28
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -733,9 +733,9 @@
 that they wish not to be flattened into one list.  For instance, C<zip()> wants
 to iterate several lists in parallel, while array and hash subscripts want to
 process multidimensional slices.  The set of underlying argument lists may be
-bound to a single array parameter declared with a C<;> twigil:
+bound to a single array parameter declared with a double C<@@> sigil:
 
-    sub foo (*@;slices) { ... }
+    sub foo (*@@slices) { ... }
 
 Note that this is different from
 
@@ -743,20 +743,24 @@
 
 insofar as C<\$slices> is bound to a single argument-list object that
 makes no commitment to processing its structure (and maybe doesn't
-even know its own structure yet), while C<*@;slices> has to create
+even know its own structure yet), while C<*@@slices> has to create
 an array that binds the incoming dimensional lists to the array's
 dimensions, and make that commitment visible to the rest of the scope
-via the twigil so that constructs expecting multidimensional lists
+via the sigil so that constructs expecting multidimensional lists
 know that multidimensionality is the intention.
 
 It is allowed to specify a return type:
 
-    sub foo (*@;slices --> Num) { ... }
+    sub foo (*@@slices --> Num) { ... }
 
 The invocant does not participate in multi-dimensional argument lists,
-so C<self> is not present in any of the C<@;slices> below:
+so C<self> is not present in any of the C<@@slices> below:
 
-    method foo (*@;slices) { ... }
+    method foo (*@@slices) { ... }
+
+The C<@@> sigil is just a variant of the C<@> sigil, so C<@@slices>
+and C<@slices> are really the same array.  In particular, C<@@_> is
+really the good old C<@_> array viewed as multidimensional.
 
 =head2 Zero-dimensional argument list
 
@@ -764,9 +768,9 @@
 argument list becomes a zero-dimensional slice.  It differs from
 C<\()> in several ways:
 
-    sub foo (*@;slices) {...}
-    foo;        # +@;slices == 0
-    foo();      # +@;slices == 1
+    sub foo (*@@slices) {...}
+    foo;        # +@@slices == 0
+    foo();      # +@@slices == 1
 
     sub bar (\$args = \(1,2,3)) {...}
     bar;        # $args === \(1,2,3)
@@ -873,15 +877,15 @@
 is a list of 6 elements.  This is the default behavior.  However,
 sometimes you want to capture the outputs as a list of two iterators,
 namely the two iterators that represent the two input pipes.  You can
-get at those two iterators by using the name C<@;foo> instead, where
+get at those two iterators by using the name C<@@foo> instead, where
 the "pipe" twigil marks a multidimensional array, that is, an
 array of slices.
 
-    0...       ==> @;foo;
-    'a'...     ==> @;foo;
-    pidigits() ==> @;foo;
+    0...       ==> @@foo;
+    'a'...     ==> @@foo;
+    pidigits() ==> @@foo;
 
-    for zip(@;foo) { say }
+    for zip(@@foo) { say }
 
        [0,'a',3]
        [1,'b',1]
@@ -891,19 +895,19 @@
        [5,'f',9]
        ...
 
-Here C<@;foo> is an array of three iterators, so
+Here C<@@foo> is an array of three iterators, so
 
-    zip(@;foo)
+    zip(@@foo)
 
 is equivalent to
 
-    zip(@;foo[0]; @;foo[1]; @;foo[2])
+    zip(@@foo[0]; @@foo[1]; @@foo[2])
 
 A semicolon inside brackets is equivalent to stacked pipes.  The code above
 could be rewritten as:
 
-    (0...; 'a'...; pidigits()) ==> my @;foo;
-    for @;foo.zip { say }
+    (0...; 'a'...; pidigits()) ==> my @@foo;
+    for @@foo.zip { say }
 
 which is in turn equivalent to
 
@@ -926,41 +930,41 @@
 then you get 0,1,2,'a','b','c'.  If you have a multidim array, you
 can ask for cat semantics explicitly with cat():
 
-    (0..2; 'a'..'c') ==> my @;tmp;
-    for @;tmp.cat { say }
+    (0..2; 'a'..'c') ==> my @@tmp;
+    for @@tmp.cat { say }
 
 As we saw earlier, "zip" produces little arrays by taking one element
 from each list in turn, so
 
-    (0..2; 'a'..'c') ==> my @;tmp;
-    for @;tmp.zip { say }
+    (0..2; 'a'..'c') ==> my @@tmp;
+    for @@tmp.zip { say }
 
 produces [0,'a'],[1,'b'],[2,'c'].  If you don't want the subarrays, then
 use C<each()> instead:
 
-    (0..2; 'a'..'c') ==> my @;tmp;
-    for @;tmp.each { say }
+    (0..2; 'a'..'c') ==> my @@tmp;
+    for @@tmp.each { say }
 
 and then you just get 0,'a',1,'b',2,'c'.  This is good for
 
-    for @;tmp.each -> $i, $a { say "$i: $a" }
+    for @@tmp.each -> $i, $a { say "$i: $a" }
 
-In list context the C<@;foo> notation is really a shorthand for C<[;](@;foo)>.
-In particular, you can use C<@;foo> to interpolate a multidimensional slice
+In list context the C<@@foo> notation is really a shorthand for C<[;](@@foo)>.
+In particular, you can use C<@@foo> to interpolate a multidimensional slice
 in an array or hash subscript.
 
-Every lexical scope gets its own implicitly declared C<@;_> variable,
-which is the default receiver.  So instead of using C<@;foo> above
-you can just say
+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 }
+    for zip(@@_) { .perl.say }
 
-If C<@;_> is currently empty, then C<for zip(@;_) {...}> would act on a
+If C<@@_> is currently empty, then C<for zip(@@_) {...}> would act on a
 zero-dimensional slice (i.e. C<for (zip) {...}>), and output nothing
 at all.
 
@@ -970,13 +974,13 @@
 So
 
     ('a'...; 0...) ==> ;
-     for zip(@;_ <== @foo) -> [$a, $i, $x] { ...}
+     for zip(@@_ <== @foo) -> [$a, $i, $x] { ...}
 
 is the same as
 
     'a'... ==> ;
      0...  ==> ;
-     for zip(@;_ <== @foo) -> [$a, $i, $x] { ...}
+     for zip(@@_ <== @foo) -> [$a, $i, $x] { ...}
 
 which is the same as
 
@@ -986,12 +990,12 @@
 
     @foo ==> ;
     0... ==> ;
-    for each(@;_) -> $x, $i { ...}
+    for each(@@_) -> $x, $i { ...}
 
 is the same as
 
     0... ==> ;
-    for each(@foo; @;_) -> $x, $i { ...}
+    for each(@foo; @@_) -> $x, $i { ...}
 
 which is the same as
 
@@ -1007,9 +1011,9 @@
     @foo.each
     @foo.cat
 
-The C<@;($foo)> coercer can be used to pull a multidim out of some
-object that contain one, such as a C<Capture> or C<Match> object.  Like
-C<@()>, C<@;()> defaults to C<@;($/)>, and returns a multidimensional
+The C<@@($foo)> coercer can be used to pull a multidim out of some
+object that contains one, such as a C<Capture> or C<Match> object.  Like
+C<@()>, C<@@()> defaults to C<@@($/)>, and returns a multidimensional
 view of any match that repeatedly applies itself with C<:g> and
 the like.  In contrast, C<@()> would flatten those into one list.
 

Modified: doc/trunk/design/syn/S09.pod
==============================================================================
--- doc/trunk/design/syn/S09.pod        (original)
+++ doc/trunk/design/syn/S09.pod        Fri Apr 21 18:01:04 2006
@@ -14,7 +14,7 @@
   Date: 13 Sep 2004
   Last Modified: 21 Apr 2006
   Number: 9
-  Version: 8
+  Version: 9
 
 =head1 Overview
 
@@ -184,20 +184,34 @@
 
     @array.postcircumfix:<[ ]>( <== @x[0] <== @x[1] <== @x[2]...);
 
-Alternately, use a multislice array, indicated by a C<;> twigil:
+Alternately, use a multislice array, indicated by a double C<@@> sigil:
 
-    @array[@;x]
+    @array[@@x]
 
-Multislice arrays have the advantage of being able to collect individual
-pipes and keep them distinct:
+Multislice arrays can keep track of their dimensionality as they
+are being defined.  Use of multislice syntax can then pull out those
+distinct dimensions:
+
+    my @@x;
+    @@x <==  %hash.keys.grep: {/^X/};
+    @@x <== =<>;
+    @@x <== 1...;
+    @@x <== gather { loop { take rand 100 } };
+
+    %hash{@@x}
+
+Conjecture, since @@x and @x are really the same object, any array can
+keep track of its dimensionality, and it only matters how you use it
+in the end:
+
+    my @x;
+    @x <==  %hash.keys.grep: {/^X/};
+    @x <== =<>;
+    @x <== 1...;
+    @x <== gather { loop { take rand 100 } };
 
-    my @;x;
-    @;x <==  %hash.keys.grep: {/^X/};
-    @;x <== =<>;
-    @;x <== 1...;
-    @;x <== gather { loop { take rand 100 } };
-
-    %hash{@;x}
+    %hash{@@x} # multidimensional
+    [EMAIL PROTECTED]  # flattened
 
 To declare a multidimensional array, you may declare it with a signature as
 if it were a function returning one of its entries:
@@ -240,7 +254,7 @@
 You can pass a multislice for the shape as well:
 
     my int @ints[[;[EMAIL PROTECTED];
-    my int @ints[@;fooshape];  # same thing
+    my int @ints[@@fooshape];  # same thing
 
 Again, the C<[;]> list operator interpolates a list into a semicolon
 list, which we do for consistency with subscript notation, not because
@@ -278,12 +292,12 @@
 
 =head1 PDL support
 
-An array C<@array> can be tied to a piddle at declaration time:
+An array C<@array> can be tied to a PDL at declaration time:
 
-    my num @array[@;mytensorshape] is Piddle;
-    my @array is Piddle(:shape(^2;^2;^2;^2)) of int8;
+    my num @array[@@mytensorshape] is PDL;
+    my @array is PDL(:shape(^2;^2;^2;^2)) of int8;
 
-Piddles are allowed to assume a type of C<num> by default rather than
+PDLs are allowed to assume a type of C<num> by default rather than
 the usual simple scalar.  (And in general, the type info is merely
 made available to the "tie" implementation to do with what it will.
 Some data structures may ignore the "of" type and just store everything
@@ -296,7 +310,7 @@
 
     @b := @a[0...:by(2)]
 
-With piddles in particular, this might alias each of the individual
+With PDLs in particular, this might alias each of the individual
 elements rather than the array as a whole.  So modifications to @b
 are likely to be reflected back into @a.  (But maybe the PDLers will
 prefer a different notation for that.)
@@ -331,7 +345,7 @@
 It is up to the implementation of C<@x> to decide how aggressively
 or lazily this subscript is evaluated, and whether the slice entails
 copying.  (The PDL folks will generally want it to merely produce a
-virtual piddle where the new array aliases its values back into the
+virtual PDL where the new array aliases its values back into the
 old one.)
 
 Of course, a single element can be selected merely by providing a single
@@ -463,7 +477,7 @@
 where that turns into something like this:
 
     role PDL_stuff[::TYPE] {
-       multi sub inner (TYPE @a, TYPE @b --> TYPE) {
+       multi inner (TYPE @a, TYPE @b --> TYPE) {
            my $n = @a.shape[0];        # or maybe $n is just a parameter
            assert($n == @b.shape[0]);  #  and this is already checked by PDL
            my TYPE $tmp = 0;

Reply via email to