Author: audreyt Date: Sun Mar 11 14:52:42 2007 New Revision: 14337 Modified: doc/trunk/design/syn/S03.pod
Log: * S03: Allow infix-assignment forms in the simple-one-arg case of variable declaration: constant Dog $fido .= new; # okay: a constant Dog object constant Dog $fido = Dog.new; # same thing However, this is not a generalized relaxation of the Signature syntax: constant Dog $fido = $fido.new; # error: cannot refer to itself constant (Dog $fido .= new); # error: cannot use .= with parens Modified: doc/trunk/design/syn/S03.pod ============================================================================== --- doc/trunk/design/syn/S03.pod (original) +++ doc/trunk/design/syn/S03.pod Sun Mar 11 14:52:42 2007 @@ -14,7 +14,7 @@ Date: 8 Mar 2004 Last Modified: 12 Mar 2007 Number: 3 - Version: 106 + Version: 107 =head1 Overview @@ -3172,6 +3172,15 @@ constant :($foo = 123); # same thing (full Signature form) constant ($foo) = 123; # wrong: constants cannot be assigned to +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 + Parentheses must always be used when declaring multiple parameters: my $a; # okay