On 7 Aug 2000 14:35:50 -0000, Perl6 RFC Librarian wrote:
> foo($x = 10, $y = 20);
>
>However, this would also be a major incompatability with Perl 5 which
>would interpret the above as something similar to:
>
> $x = 10;
> $y = 20;
> foo($x, $y);
Apart from the scoping, which should be limited to the sub's body block,
it's roughly what it should do.
>This has a dangerous and unpredictable side-effect which we would rather
>avoid. So the third and preferred candidate is:
>
> foo(x = 10, y = 20);
Well, I do feel that dropping variable prefixes without any reason is
unnecessary and confusing. People might wonder why they need them at
all. (And I'm pretty sure somebody proposed to drop those.)
Why not a new syntax?
foo($x : 10, $y : 20);
bar($z : 30, @t : (1, 2, 3));
To me, the colon indicates something like expectation: $x will become
10, but not just yet.
The colon has been proposed for several uses in the syntax, and I can't
see why this should conflict with that.
p.s. Has anybody already proposed Lisp's delayed evaluation of argument
expressions? We could create our own shortcut functions, then. :-)
--
Bart.