Author: larry Date: Fri Oct 26 02:53:13 2007 New Revision: 14467 Modified: doc/trunk/design/syn/S03.pod
Log: String composition operators now get their own two precedence levels looser than number composers but tighter than junctions, as suggested by tye++. Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Fri Oct 26 02:53:13 2007 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 14 Sep 2007 + Last Modified: 26 Oct 2007 Number: 3 - Version: 123 + Version: 124 =head1 Overview @@ -22,9 +22,10 @@ =head1 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: +Not counting terms and terminators, Perl 6 has 23 operator precedence +levels (same as Perl 5, but differently arranged). Here we list the +levels from "tightest" to "loosest", along with a few examples of +each level: Level Examples ===== ======== @@ -33,8 +34,10 @@ Autoincrement ++ -- Exponentiation ** Symbolic unary ! + - ~ ? | +^ ~^ ?^ \ ^ = - Multiplicative * / % x xx +& +< +> ~& ~< ~> ?& div mod - Additive + - ~ +| +^ ~| ~^ ?| ?^ + Multiplicative * / % +& +< +> ~& ~< ~> ?& div mod + Additive + - +| +^ ~| ~^ ?| ?^ + Replication x xx + Concatenation ~ Junctive and (all) & Junctive or (any) | ^ Named unary rand sleep abs @@ -711,38 +714,6 @@ =item * -C<< infix:<x> >>, string/buffer replication - - $string x $count - -Evaluates the left argument in string context, replicates the resulting -string value the number of times specified by the right argument and -returns the result as a single concatenated string regardless of context. - -If the count is less than 1, returns the null string. -The count may not be C<*> because Perl 6 does not support -infinite strings. (At least, not yet...) Note, however, that an -infinite string may be emulated with C<cat($string xx *)>. - -=item * - -C<< infix:<xx> >>, list replication - - @list xx $count - -Evaluates the left argument in list context, replicates the resulting -C<Capture> value the number of times specified by the right argument and -returns the result in a context dependent fashion. If the operator -is being evaluated in ordinary list context, the operator returns a -flattened list. In slice (C<@@>) context, the operator converts each C<Capture> -to a separate sublist and returns the list of those sublists. - -If the count is less than 1, returns the empty list, C<()>. -If the count is C<*>, returns an infinite list (lazily, since lists -are lazy by default). - -=item * - C<< infix:{'+&'} >>, numeric bitwise and $x +& $y @@ -825,12 +796,6 @@ =item * -C<< infix:<~> >>, string/buffer concatenation - - $x ~ $y - -=item * - C<< infix:<+|> >>, numeric bitwise inclusive or $x +| $y @@ -867,6 +832,56 @@ =back +=head2 Replication + +=over + +=item * + +C<< infix:<x> >>, string/buffer replication + + $string x $count + +Evaluates the left argument in string context, replicates the resulting +string value the number of times specified by the right argument and +returns the result as a single concatenated string regardless of context. + +If the count is less than 1, returns the null string. +The count may not be C<*> because Perl 6 does not support +infinite strings. (At least, not yet...) Note, however, that an +infinite string may be emulated with C<cat($string xx *)>. + +=item * + +C<< infix:<xx> >>, list replication + + @list xx $count + +Evaluates the left argument in list context, replicates the resulting +C<Capture> value the number of times specified by the right argument and +returns the result in a context dependent fashion. If the operator +is being evaluated in ordinary list context, the operator returns a +flattened list. In slice (C<@@>) context, the operator converts each C<Capture> +to a separate sublist and returns the list of those sublists. + +If the count is less than 1, returns the empty list, C<()>. +If the count is C<*>, returns an infinite list (lazily, since lists +are lazy by default). + +=back + +=head2 Concatenation + +=over + +=item * + +C<< infix:<~> >>, string/buffer concatenation + + $x ~ $y + +=back + =head2 Junctive and (all) precedence =over