Author: autrijus
Date: Fri May 12 18:49:49 2006
New Revision: 9222
Modified:
doc/trunk/design/syn/S06.pod
Log:
* S06: Only bare keys with valid identifier names are recognized
as named arguments:
doit when => 'now'; # always a named arg
doit 'when' => 'now'; # always a positonal arg
doit 123 => 'now'; # always a positonal arg
doit :123<now>; # always a positonal arg
* S06: Named interpolation is now always via %() in the [,] zone:
$pair = :when<now>;
doit $pair,1,2,3; # always a positional arg
doit [,] %$pair,1,2,3; # always a named arg
doit [,] %(get_pair()),1,2,3; # always a named arg
doit [,] %('when' => 'now'),1,2,3; # always a named arg
Modified: doc/trunk/design/syn/S06.pod
==============================================================================
--- doc/trunk/design/syn/S06.pod (original)
+++ doc/trunk/design/syn/S06.pod Fri May 12 18:49:49 2006
@@ -362,14 +362,21 @@
doit (when => 'now'),1,2,3; # always a positional arg
doit 'when' => 'now',1,2,3; # always a positional arg
+Only bare keys with valid identifier names are recognized as named arguments:
+
+ doit when => 'now'; # always a named arg
+ doit 'when' => 'now'; # always a positonal arg
+ doit 123 => 'now'; # always a positonal arg
+ doit :123<now>; # always a positonal arg
+
Going the other way, pairs intended as named arguments that don't look
like pairs must be introduced with the C<[,]> reduction operator:
$pair = :when<now>;
doit $pair,1,2,3; # always a positional arg
- doit [,] $pair,1,2,3; # always a named arg
- doit [,]('when' => 'now'),1,2,3; # always a named arg
- doit [,] get_pair(),1,2,3; # always a named arg
+ doit [,] %$pair,1,2,3; # always a named arg
+ doit [,] %(get_pair()),1,2,3; # always a named arg
+ doit [,] %('when' => 'now'),1,2,3; # always a named arg
Note that, to apply C<[,]> to a single arg you may need to use parentheses.
In general it doesn't matter.