in reply to Logical/defined or as lvalue
What is the reason for the logical/defined or operators not to provide an lvalue as result?
I don't know. It may have been oversight, or there may have been an explicit or implicit rationale that has most likely been lost in the mists of time.
Would changing this behaviour break any existing code?
My first guess would be autovivification: $h{$_} behaves differently in lvalue and rvalue contexts, which is already enough to cause regular confusion. Also any classes that provide overloading of these operators is likely to have been designed to the current behaviour.
Is the usage of ${\(X // Y)} as an lvalue well-defined behaviour?
I think it probably depends on X and Y, but in the cases where it is legal to take the reference, I think I'd expect the dereference to be well-behaved. In other words: where it works, I wouldn't expect it to suddenly stop working.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Logical/defined or as lvalue
by Fletch (Bishop) on Sep 04, 2024 at 03:09 UTC | |
|
Re^2: Logical/defined or as lvalue
by jo37 (Curate) on Sep 04, 2024 at 08:40 UTC | |
|
Re^2: Logical/defined or as lvalue
by LanX (Saint) on Sep 03, 2024 at 22:15 UTC | |
|
Re^2: Logical/defined or as lvalue
by hv (Prior) on Sep 03, 2024 at 21:56 UTC | |
by jdporter (Paladin) on Sep 03, 2024 at 22:17 UTC |