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$