I expect that the inefficient copying you're worried about would happen either way.
Actually, no. With the current implementation, the lvalue method gives the substitution operator direct access to the underlying memory. Indeed, it this desire to retain this efficient, direct access that is behind TimToady's reluctance to change the current mechanism for one that would allow validation. I like the ability to achieve that efficiency, but not so much that I wouldn't give it up for the ability to verify the assignment.
But the efficiency is only one of the list of benefits I outlined. Most of the others, including 2 or 3 that I thought would be very close to your heart--those that prevent the possibilities of errors being introduced--are much more relevant and desirable.
I fail to understand how you can find: $obj->thing =~ s[this][that]g;
confusing, but not $string =~ s[this][that]g;?
But maybe the question is not how, but why!
In reply to Re^8: Assignable Subroutines
by BrowserUk
in thread Assignable Subroutines
by dragonchild
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |