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

Re: chained comparisons

Thread Previous | Thread Next
Dan Book
April 28, 2020 19:21
Re: chained comparisons
Message ID:
On Tue, Apr 28, 2020 at 11:20 AM Zefram via perl5-porters <> wrote:

> David Nicol wrote:
> >does turning the tied thing into an expression by applying a no-op to it
> in
> >perl code prevent the second fetch?
> >
> >lower <= 0+$tied_thing < upper
> Yes.  In that case the tied value is fetched by the addition op, which
> only runs once, and the two comparisons will be applied to the result
> of the addition, which (unless there's some funny overloading going on)
> will be non-magical.

I've opened to hopefully provide
this clearer explanation in the docs. Other than explaining that better,
this functionality seems correct to me.


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