Author: audreyt Date: Mon Mar 5 08:27:24 2007 New Revision: 14310 Modified: doc/trunk/design/syn/S12.pod
Log: * S12: Clarify that VAR(1) and VAR(@foo) are simply no-ops; i.e., it applies to thiings other than Scalars, too. Also fixed the postfix macro name and nomenclature around .VAR. Modified: doc/trunk/design/syn/S12.pod ============================================================================== --- doc/trunk/design/syn/S12.pod (original) +++ doc/trunk/design/syn/S12.pod Mon Mar 5 08:27:24 2007 @@ -12,9 +12,9 @@ Maintainer: Larry Wall <[EMAIL PROTECTED]> Date: 27 Oct 2004 - Last Modified: 20 Feb 2007 + Last Modified: 6 Mar 2007 Number: 12 - Version: 42 + Version: 43 =head1 Overview @@ -332,18 +332,23 @@ @keys = %hash.keys; $sig = &sub.signature; -Use the C<VAR> pseudo-function on a scalar variable to get at its +Use the prefix C<VAR> macro on a scalar variable to get at its underlying C<Scalar> object: if VAR($scalar).readonly {...} -There's also a corresponding postfix:<VAR> macro that can be used +C<VAR> is a no-op on a non-scalar variables and values: + + VAR(1); # 1 + VAR(@x); # @x + +There's also a corresponding C<< postfix:<.VAR> >> macro that can be used as if it were a method: if $scalar.VAR.readonly {...} (But since it's a macro, C<VAR> is not dispatched as a real method. -To dispatch to a real C<.VAR> method use the indirect C<$obj."VAR"> +To dispatch to a real C<.VAR> method, use the indirect C<$obj."VAR"> form.) You can also get at the container through the appropriate symbol table: