On Tue, 13 Aug 2002, Deven T. Corzine wrote:
: However, will the "func($x{1}{2}{3})" case cause an implementation problem?

This is why the new function type signatures will assume that
parameters are constant.  If you want a modifiable parameter, you
have to say "is rw".  Then it's considered an lvalue.  In Perl 5,
all function args had to be considered potential lvalues.

In essence, all Perl 5 functions have a signature of (*@_ is rw).
Perhaps the translator can turn some of those into (*@_).  What'd
really be cool is if it could pick up an initial

    my ($a, $b, $c) = @_;

and turn it into an appropriate signature.  Of course, there are issues
here if the code modifies those variables, since the issue of whether
a variable is rw is really distinct from whether it represents a pass
by value or reference.  Slapping a "constant" on it is a bald-faced
attempt to get the speed of pass-by-reference with the guarantees of
pass-by-value.  Perhaps there should be a way to declare a parameter
to be pass-by-value, producing a modifiable variable that does not
affect the caller's value.  But I'm not sure saving one assignment
in the body is worth the extra mental baggage.

Larry

Reply via email to