Author: carlin Date: 2009-08-25 02:26:56 +0200 (Tue, 25 Aug 2009) New Revision: 28060
Modified: docs/Perl6/Perl5/Differences.pod docs/Perl6/Spec/S03-operators.pod Log: [Differences.pod] Added a before/after comparison of the binary numeric AND. Added a note about the bitwise operator prefixes and added a before/after comparison of the shift left operator and the shift left assignment operator. [S03] Added an explicit example of an assignment operator. Modified: docs/Perl6/Perl5/Differences.pod =================================================================== --- docs/Perl6/Perl5/Differences.pod 2009-08-25 00:24:05 UTC (rev 28059) +++ docs/Perl6/Perl5/Differences.pod 2009-08-25 00:26:56 UTC (rev 28060) @@ -154,6 +154,20 @@ is binary string AND, C<+&> is binary numeric AND, C<~|> is binary string OR etc. + Was: $foo & 1; + Now: $foo +& 1; + +The bitwise operators are now prefixed with a +, ~ or ? depending if the +data type is a number, string or boolean. + + Was: $foo << 42; + Now: $foo +< 42; + +The assignment operators have been changed in a similar vein: + + Was: $foo <<= 42; + Now: $foo +<= 42; + Parenthesis don't construct lists, they merely group. Lists are constructed with the comma operator. It has tighter precedence than the list assignment operator, which allows you to write lists on the right hand side Modified: docs/Perl6/Spec/S03-operators.pod =================================================================== --- docs/Perl6/Spec/S03-operators.pod 2009-08-25 00:24:05 UTC (rev 28059) +++ docs/Perl6/Spec/S03-operators.pod 2009-08-25 00:26:56 UTC (rev 28060) @@ -2326,7 +2326,10 @@ (one's complement) becomes either C<+^> or C<~^> or C<?^>, since a bitwise NOT is like an exclusive-or against solid ones. Note that C<?^> is functionally identical to C<!>, but conceptually coerces to -boolean first and then flips the bit. Please use C<!> instead. +boolean first and then flips the bit. Please use C<!> instead. As +explained in L</Assignment operators>, a bitwise operator can be turned +into its corresponding assignment operator by following it with C<=>. +For example Perl 5's C< <<= > becomes C< +<= >. C<?|> is a logical OR but differs from C<||> in that C<?|> always evaluates both sides and returns a standard boolean value. That is,