Author: audreyt Date: Mon Mar 12 14:20:51 2007 New Revision: 14342 Modified: doc/trunk/design/syn/S03.pod
Log: * S06: Clarify that simple parenless form of declarators must support list-context assignment. Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Mon Mar 12 14:20:51 2007 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 8 Mar 2004 - Last Modified: 12 Mar 2007 + Last Modified: 13 Mar 2007 Number: 3 - Version: 108 + Version: 109 =head1 Overview @@ -3183,18 +3183,23 @@ associated type, traits and the initializer: constant $foo = 123; # okay: initializes $foo to 123 - constant ($foo = 123); # same thing + constant ($foo = 123); # same thing (with explicit parens) constant :($foo = 123); # same thing (full Signature form) constant ($foo) = 123; # wrong: constants cannot be assigned to +List-context assignment is supported for simple declarations: + + constant @foo = 1,2,3; # okay: initializes @foo to (1,2,3) + constant (@foo = 1,2,3); # wrong: 2 and 3 are not variable names + When parentheses are omitted, you may use an infix assignment operator instea dof C<=> as the initializer. In that case, the left hand side of the infix operator will be the variable's prototype object: constant Dog $fido .= new; # okay: a constant Dog object constant Dog $fido = Dog.new; # same thing - constant Dog $fido = $fido.new; # error: cannot refer to itself - constant (Dog $fido .= new); # error: cannot use .= with parens + constant Dog $fido = $fido.new; # wrong: invalid self-reference + constant (Dog $fido .= new); # wrong: cannot use .= with parens Parentheses must always be used when declaring multiple parameters: