good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^5: can sub check context for lvalue vs rvalue context?by BrowserUk (Patriarch) |
on May 10, 2018 at 07:19 UTC ( [id://1214313]=note: print w/replies, xml ) | Need Help?? |
The same situation holds with the no-longer-experimental ':lvalue' subs. They just need the same treatment as dual-return subs returning scalar or array -- i.e. a keyword to let the sub know context. (Part of) My point is that the caller can take a reference to whatever you return, and at some point later dereference that pointer and assign through it; with the expectation that the next time they call your sub, it will return the new value they've assigned; but taking a reference is explicitly an rvalue operation. If you could detect the rvalue context and returned "a simple rvalue", you break that expectation. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.
Suck that fhit
In Section
Seekers of Perl Wisdom
|
|