Re: RFC 132 (v3) Subroutines should be able to return an lvalue
[email protected] ((Johan Vromans)) Fri, 1 Sep 2000 09:21:26 +0200 (CEST)
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Message-ID | <[email protected]> |
[Quoting Nathan Wiger, on August 31 2000, 14:40, in "Re: RFC 132 (v3) Sub"]
> > sub param {
> > my ($self, @rest) = @_;
> > $self->{aval} = @rest if @rest; # See note
> > lreturn $self->{aval};
> > }
>
> I've been thinking about this for a couple days. The only problem I see
> is that this doesn't allow me to do this:
>
> $oldpath = $tree->path('L','R') = 'R';
Yes. And I think that's a good thing. Upon seeing "$x = $y = $z"
people expect $y _and_ $x to get $z assigned.
Of course, with tie you can play a lot of dirty tricks.
-- Johan