Author: larry
Date: Sun Jan 28 16:04:21 2007
New Revision: 13542
Modified:
doc/trunk/design/syn/S03.pod
doc/trunk/design/syn/S06.pod
Log:
Typos from (Joe and Mark)++
Rethink of low-precedence priority to unify listops with contextualizers.
Comma precedence now separate to avoid former sophistry.
Precedence is now: comma << list infix << list prefix
Can now parse "chunky" contextualizer as listop:
@@('a','b' XX 1,2) # returns ['a',1],['a',2],['b',1],['b',2]
@@: 'a','b' XX 1,2 # same thing
Feed operators are no longer list infix, "demoted" to statement separators.
Explicit target of a feed now just an empty contextualizer.
The each function now gone in favor of smooth/chunky contextualized zip.
Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podSun Jan 28 16:04:21 2007
@@ -12,9 +12,9 @@
Maintainer: Larry Wall <[EMAIL PROTECTED]>
Date: 8 Mar 2004
- Last Modified: 26 Jan 2007
+ Last Modified: 28 Jan 2007
Number: 3
- Version: 91
+ Version: 92
=head1 Overview
@@ -22,7 +22,7 @@
=head1 Operator precedence
-Not counting terms and terminators, Perl 6 has 20 operator precedence
+Not counting terms and terminators, Perl 6 has 21 operator precedence
levels. (Perl 5 has 23!) Here we list the levels from "tightest" to
"loosest", along with a few examples of each level:
@@ -45,11 +45,12 @@
Conditional ?? !!
Item assignment = := ::= => += -= **= xx= .=
Loose unary true not
-List ops, = print push say die map substr ... [+] [*] any all
-List infix ¥ <== ==> minmax X XX X~X X*X XeqvX
+Comma operator ,
+List infix ¥ minmax X XX X~X X*X XeqvX
+List prefix = : print push say die map substr ... [+] [*] any all
Loose and and
Loose oror xor err
-Terminator ; {...}, modifiers, unmatched ), ], }
+Terminator ; <==, ==>, {...}, modifiers, unmatched ), ], }
If you don't see your favorite operator there, the following
sections cover all the operators in precedence order. Basic operator
@@ -454,7 +455,7 @@
=item *
-infix:
+infix:, generic division
$dividend div $divisor
@@ -466,6 +467,16 @@
%
+Always floor semantics using Num or Int.
+
+=item *
+
+infix:, generic modulus
+
+mod
+
+Dispatches to the infix: multi most appropriate to the operand types.
+
=item *
infix:, string replication
@@ -492,7 +503,7 @@
=item *
-infix:{'+<'}, numeric shift right
+infix:{'+>'}, numeric shift right
+>
@@ -520,18 +531,6 @@
?&
-=item *
-
-infix:, generic division
-
-div
-
-=item *
-
-infix:, generic modulus
-
-mod
-
=back
=head2 Additive precedence
@@ -974,24 +973,12 @@
=back
-=head2 List ops precedence
+=head2 Comma operator precedence
=over
=item *
-infix:<=>, list assignment
-
-@array = 1,2,3;
-
-With compound targets, performs list assignment. The right side is looser
-than comma. You can view the left side as a special syntax for a prefix
-listop, much as if you'd said:
-
-@array.assign: 1,2,3
-
-=item *
-
infix:<,>, the argument separator
1, 2, 3, @many
@@ -999,148 +986,156 @@
Unlike in Perl 5, comma operator never returns the last value. (In item
context it returns a list instead.)
-=item *
+=back
-infix:<:>, the invocant marker
+=head2 List infix precedence
-say $*OUT: "howdy, world"
+List infixes all have list associativity, which means that identical
+infix operators work together in parallel rather than one after
+the other. Non-identical operators are considered non-associative
+and must be parenthesized for clarity.
-The colon that turns a method call into a list operator also sits
-in the "comma" slot. It cannot be used just anywhere though.
-Much like list assignment, it takes a special syntax on the left
-side and turns it into a list operator over the list on the right.
-See L.
-
-Comma, C<=>, and C<:> are the only listops that are allowed to occur
-where an infix is expected. All other listops function as a term
-within the expression to the left.
+=over
=item *
-Normal listops
+infix:<¥>, the zip operator
-print push say join split substr open etc.
+1,2 ¥ 3,4 # (1,3),(2,4)
=item *
-Listop forms of junctional operators
+The minmax operator
-any all one none
+$min0, $max0 minmax $min1, $max1# ($min0 min $min1, $max0 max $max1)
=item *
-Exception generators
+List and string cross operators
-fail "Division by zero"
-die System::Error(ENOSPC,"Drive $d seems to be full");
-warn "Can't open file: $!"
+1,2 XX 3,4 # (1,3), (1,4), (2,3), (2,4)
+1,2 X 3,4 # '13', '14', '23', '24'
-=item *
+In contrast to the zip operator, the C operator returns all the
+permutations of its sublists. Hence y