Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^6: Logical/defined or as lvalue

by jo37 (Curate)
on Sep 04, 2024 at 18:36 UTC ( [id://11161590]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Logical/defined or as lvalue
in thread Logical/defined or as lvalue

In retrospective, I shouldn't have brought up || as I don't see any use for an lvalue expression X || Y neither, which would be equivalent to the "Elvis operator".

A possible novelty could be a binary operator that:

  • acts like defined(X) ? X : Y
  • yields an lvalue, provided X and Y are lvalues
  • evaluates X only once
If X // Y was an lvalue, it would satisfy these criteria. As it currently isn't, it could hardly break anything as such usage doesn't compile. No new operator, just an extension. In a Perlish sense: One more way to do it.

Greetings,
🐻

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

Replies are listed 'Best First'.
Re^7: Logical/defined or as lvalue
by ikegami (Patriarch) on Sep 04, 2024 at 21:05 UTC

    Everything I said about || also applies to //. You only mention backwards-compatibility which wasn't even an issue I raised.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2026-03-05 23:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.