Re: RFC 132 (v3) Subroutines should be able to return an lvalue
[email protected] (Nathan Wiger) Thu, 31 Aug 2000 14:40:18 -0700
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Organization | Sun Microsystems |
| Message-ID | <[email protected]> |
Johan Vromans wrote:
>
> You can do that easily:
>
> 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';
@document = ($title, $junk, $r->xml_extract) = <STDIN>;
I would still have to use some yeechy combination with tie under your
RFC. Like Nat, I want to be able to have things return different values
than they assigned, even when used in an lvalue context. Hence RFC 154.
Please correct me if I'm wrong in my understanding that lreturn can't do
this.
-Nate