Carl Mäsak skribis 2006-08-23 21:54 (+0200):
> Juerd (>), Michael Snoyman (>>):
> >> sub mysub($foo, @foo, %foo) {
> >I hope this is a compile time failure. If not, I'd expect a warning, at
> >least.
> Why? It looks reasonable IMHO.
Because arguments are passed without sigil, and here you'd be forcing
positional arguments. I think that's bad.
sub do_something ($foo) { ... }
do_something [ 1, 2 ];
do_something foo => [ 1, 2 ];
do_something :foo([ 1, 2 ]);
sub do_something (@foo) { ... }
do_something [ 3, 4 ];
do_something foo => [ 3, 4 ];
do_something :foo([ 3, 4 ]);
sub do_something ($foo, @foo) { ... }
do_something [ 1, 2 ], [ 3, 4 ];
# But how do you pass named arguments now?
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html