Author: lwall Date: 2009-02-24 19:23:06 +0100 (Tue, 24 Feb 2009) New Revision: 25527
Modified: docs/Perl6/Spec/S03-operators.pod docs/Perl6/Spec/S06-routines.pod docs/Perl6/Spec/S28-special-variables.pod Log: clarify what happens when associativity conflicts arise allow both tighter and looser at the same time remove all the synthetic @? variables; use the symbol tables directly Modified: docs/Perl6/Spec/S03-operators.pod =================================================================== --- docs/Perl6/Spec/S03-operators.pod 2009-02-24 17:53:22 UTC (rev 25526) +++ docs/Perl6/Spec/S03-operators.pod 2009-02-24 18:23:06 UTC (rev 25527) @@ -12,9 +12,9 @@ Maintainer: Larry Wall <la...@wall.org> Date: 8 Mar 2004 - Last Modified: 12 Feb 2009 + Last Modified: 24 Feb 2009 Number: 3 - Version: 153 + Version: 154 =head1 Overview @@ -95,6 +95,13 @@ Similarly, if the only implementation of a list-associative operator is binary, it will be treated as right associative. +The standard precedence levels attempt to be consistent in their +associativity, but user-defined operators and precedence levels may mix +right and left associative operators at the same precedence level. +If two conflicting operators are used ambiguously in the same +expression, the operators will be considered non-associative with +respect to each other, and parentheses must be used to disambiguoate. + If you don't see your favorite operator above, the following sections cover all the operators in precedence order. Basic operator descriptions are here; special topics are covered afterwards. Modified: docs/Perl6/Spec/S06-routines.pod =================================================================== --- docs/Perl6/Spec/S06-routines.pod 2009-02-24 17:53:22 UTC (rev 25526) +++ docs/Perl6/Spec/S06-routines.pod 2009-02-24 18:23:06 UTC (rev 25527) @@ -13,9 +13,9 @@ Maintainer: Larry Wall <la...@wall.org> Date: 21 Mar 2003 - Last Modified: 20 Feb 2009 + Last Modified: 24 Feb 2009 Number: 6 - Version: 101 + Version: 102 This document summarizes Apocalypse 6, which covers subroutines and the @@ -1667,10 +1667,21 @@ =item C<is tighter>/C<is looser>/C<is equiv> Specifies the precedence of an operator relative to an existing -operator. C<tighter> and C<looser> operators default to being left -associative. +operator. C<tighter> and C<looser> precedence levels default to +being left associative. They define a new precedence level slighty +tighter or looser than the precedence level on which they're based. +Both C<tighter> and C<looser> may be specified, in which case the new +precedence level is generated midway between the specified levels. -C<equiv> on the other hand also clones other traits, so it specifies +Two different declarations using the same precedence derivation end +up at the same precedence level, as if C<equiv> was specified instead +of C<tighter>/C<looser>, and the second will clone the associativity +of the first. If the second explicitly specifies an associativity +that differs from the first, unexpected parsing conflicts may result. +(See S03.) + +In addition to cloning the precedence level, +C<equiv> also clones other traits, so it specifies the default associativity to be the same as the operator to which the new operator is equivalent. The following are the default equivalents for various syntactic categories if neither C<equiv> nor Modified: docs/Perl6/Spec/S28-special-variables.pod =================================================================== --- docs/Perl6/Spec/S28-special-variables.pod 2009-02-24 17:53:22 UTC (rev 25526) +++ docs/Perl6/Spec/S28-special-variables.pod 2009-02-24 18:23:06 UTC (rev 25527) @@ -46,10 +46,8 @@ $0, $1, $2 S05 # first captured value from match: $/[0] @*ARGS S06 # command-line arguments &?BLOCK S06 # current block (itself) - @?BLOCK S06 # current blocks (themselves) ::?CLASS # current class (as package name) $?CLASS # current class (as variable) - @?CLASS # current classes %?CONFIG # configuration hash $=DATA # data block handle (=begin DATA ... =end) $*EGID # effective group id @@ -59,14 +57,11 @@ $*EXECUTABLE_NAME # executable name $?FILE # current filename of source file $?GRAMMAR # current grammar - @?GRAMMAR # current grammars $*GID # group id $*IN S16 # Standard input handle; is an IO object $?LABEL # label of current block - @?LABEL # labels of current blocks $?LINE # current line number in source file $?MODULE # current module - @?MODULE # current modules %*OPTS S19 # Options from command line %*OPT... S19 # Options from command line to be passed down %*OPTS S19 # Options from command line @@ -77,7 +72,6 @@ $*OSVER # operating system version running under $*OUT S16 # Standard output handle; is an IO object $?PACKAGE # current package (as object) - @?PACKAGE # current packages $?PACKAGENAME S10 # name of current package $?PERLVER # perl version compiled for $*PERLVER # perl version running under @@ -85,9 +79,7 @@ $*PID # system process id ::?ROLE # current role (as package name) $?ROLE # current role (as variable) - @?ROLE # current roles &?ROUTINE S06 # current sub or method (itself) - @?ROUTINE # current subs or methods (themselves) $*STDERR S16 # standard error handle; is an IO object $*STDIN S16 # standard input handle; is an IO object $*STDOUT S16 # standard output handle; is an IO object @@ -174,17 +166,17 @@ Perl 5 Perl 6 Comment ----------- ----------- ----------------------- - STDIN $*STDIN See S16; you probably want $*IN - STDOUT $*STDOUT See S16; you probably want $*OUT - STDERR $*STDERR See S16; you probably want $*ERR + STDIN $*IN See S16; actual variable is $PROCESS::IN + STDOUT $*OUT See S16; actual variable is $PROCESS::OUT + STDERR $*ERR See S16; actual variable is $PROCESS::ERR $_ $_ More lexically aware $_[1],$_[2].. $^a,$^b.. $a,$b - Just params to anonymous block - $/ Object with results of last regex match $1,$2,$3... $1,$2,$3... $&, $MATCH $<> - $`, $PREMATCH $<pre> - $', $POSTMATCH $<post> + $`, $PREMATCH substr based on $/.from + $', $POSTMATCH substr based on $/.to $+ - But info can now be retrieved from $/ $^N $*MOST_RECENT_CAPTURED_MATCH ...or some such. or $/[-$n] ...or omit