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

Should lvalue subs copy read-only scalars?

Thread Next
Father Chrysostomos
June 5, 2011 20:23
Should lvalue subs copy read-only scalars?
Message ID:
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

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About