develooper Front page | perl.perl5.porters | Postings from April 2020

Re: chained comparisons

Thread Previous | Thread Next
Zefram via perl5-porters
April 5, 2020 06:09
Re: chained comparisons
Message ID:
Sawyer X wrote:
>Zefram, can you take a look, please? I am in agreement that a single FETCH is
>a reasonable user expectation.

We discussed this very issue earlier.  The expression is evaluated to an
SV only once, under control of the chaining mechanism.  But get magic
happens twice, because that's performed by the comparison operation
itself.  A tied fetch operation is part of get magic, not evaluation.
Perl's interleaving of lvalue and rvalue aspects of scalars, in particular
the way get magic mutates the scalar in place rather than returning a
separate value, prevents us from separating the get magic from the rest
of the comparison op.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About