Author: autrijus
Date: Mon Apr 3 15:48:30 2006
New Revision: 8555
Modified:
doc/trunk/design/syn/S06.pod
Log:
* S06: Make it clear that concat-means-concat for duplicated
named arguments, and that it is possible to bind a tuple
into a scalar.
sub fun (Int @x) { ... }
fun( x => (1, 2), x => (3, 4) ); # @x := (1, 2, 3, 4)
sub fun (Int $x) { ... }
fun( x => (1, 2), x => (3, 4) ); # $x := (3, 4)
Modified: doc/trunk/design/syn/S06.pod
==============================================================================
--- doc/trunk/design/syn/S06.pod (original)
+++ doc/trunk/design/syn/S06.pod Mon Apr 3 15:48:30 2006
@@ -423,15 +423,17 @@
to be concatenated:
sub fun (Int @x) { ... }
- fun( x => 1, x => 2 ); # @x := (1, 2)
+ fun( x => 1, x => 2 ); # @x := (1, 2)
+ fun( x => (1, 2), x => (3, 4) ); # @x := (1, 2, 3, 4)
Other sigils binds only to the I<last> argument with that name:
sub fun (Int $x) { ... }
- f( x => 1, x => 2 ); # $x := 2
+ f( x => 1, x => 2 ); # $x := 2
+ fun( x => (1, 2), x => (3, 4) ); # $x := (3, 4)
-This means a defaults must come I<before> known named parameters,
-similar to how hash constructors work:
+This means a hash holding default values must come I<before> known named
+parameters, similar to how hash constructors work:
# Allow "x" and "y" in %defaults be overrided
f( *%defaults, x => 1, y => 2 );