On Wed, 14 Aug 2002 15:40:35 -0600 (MDT), Luke Palmer wrote:
> We could make arglists exactly equivilent to the way they're done in Perl 5,
> which is a good way.
>
>       sub foo($a, $b, *@c) {...}
>
> Would be exactly equivilent to Perl 5's
>
>       sub foo { my ($a, $b, @c) = @_; ... }
>
> Since variables are copy-on-write, you get the speed of pass-by-reference
> with the mutability of pass-by-value, which is what everyone wants.

No you don't. Since the arguments have to be copied into the local
variables, you get the speed of pass-by-value along with its mutability.
That doesn't sound like what everyone wants to me.

> If you have this, why would you want to do enforced const reference?

Because it's the safest and fastest option. Of course this isn't what
everyone wants, either. However, by making the programmer explictly ask for
the other options (of which there are sevaral), we only give them exactly
what they want. Perl 5 gives you the most flexible way by default (pass by
ref, modifiable), and makes one other option (pass by val, modifiable) easy,
but has occassionally surprising results, such as autovivification.

-- 
        Peter Haworth   [EMAIL PROTECTED]
E is for emacs, which rebinds your keys, and
F is for fsck, which rebuilds your trees.
G is for grep, a clever detective, while
H is for halt, which may seem defective.

Reply via email to