develooper Front page | perl.perl5.porters | Postings from October 2011

Re: Should lvalue subs copy read-only scalars?

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
October 8, 2011 13:05
Subject:
Re: Should lvalue subs copy read-only scalars?
Message ID:
20111008200520.GC19034@klangraum.plasmasturm.org
* Father Chrysostomos <sprout@cpan.org> [2011-06-06 05:25]:
> Lvalue subs, as far as I can tell, have always copied read-only
> scalars returned in pass-by-reference context (in for(...) or a sub’s
> arguments). This seems odd to me. I thought the whole point of lvalue
> subs was to return the actual result of the last statement, and not
> a copy of it.
>
> Just as
>
> for($$) {
>  $_ = 1
> }
>
> is an error, should not the same apply to this?
>
> for(sub :lvalue { $$ }) {
>  $_ = 1
> }

Yes.

This got warnocked. I think this is the direction already taken in the
meantime – right?

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About