Re: RFC 132 (v1) subroutines should be able to return an lvalue
[email protected] (Damian Conway) Sun, 20 Aug 2000 16:37:19 +1000 (EST)
| Newsgroups | perl.perl6.language.subs |
|---|---|
| Message-ID | <[email protected]> |
> If you do it as scalar only. You lose a lot of useful possiblities.
This is indisputable.
> Why do you mind having an attribute?
The problem would seem to be that an lvalue subroutine might return
either an array or a scalar, depending on its arguments. That *can't*
be resolved at compile-time, no matter how many attributes we give it.
> Is there anyting in perl that defines the order of evaluation?
Yes. Try this:
$hash{<>} = <>;
RHS always evaluates first.
I'm not sure how critical that rule is though, especially if
"assignment to subroutine return value" were a special case.
Damian