Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: can sub check context for lvalue vs rvalue context?

by BrowserUk (Patriarch)
on May 09, 2018 at 15:15 UTC ( [id://1214281]=note: print w/replies, xml ) Need Help??


in reply to Re^2: can sub check context for lvalue vs rvalue context?
in thread can sub check context for lvalue vs rvalue context?

So I'd say that x() is primarily in lvalue context here.

That implies it has a secondary context. It doesn't. When an lvalue sub is called, it always does the same thing. Returns an lvalue to the calling context.

And what's being assigned to @x is not the return value of x(), but the return value of the assignment operation, which is an lvalue itself.

What is assigned to @x, is the result of the rvalue expression. And that, is the result of the assignment to lvalue returned by the subroutine.


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
  • Comment on Re^3: can sub check context for lvalue vs rvalue context?

Replies are listed 'Best First'.
Re^4: can sub check context for lvalue vs rvalue context?
by haukex (Archbishop) on May 10, 2018 at 11:20 UTC
    That implies it has a secondary context. It doesn't.

    Yes, of course - I was a little sloppy with my language.

    And what's being assigned to @x is not the return value of x(), but the return value of the assignment operation, which is an lvalue itself.
    What is assigned to @x, is the result of the rvalue expression. And that, is the result of the assignment to lvalue returned by the subroutine.

    Yes, I think we're both saying the same thing here.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1214281]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-25 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found