in reply to Re: optimization - exists should return a reference
in thread optimization - exists should return a reference

My first thought was indeed common subexpression elimination. But Elian pointed out that this can't be done because you don't know at compile time that the hash dereferences don't have side effects (they may be tied or magic).

So, to not evaluate the dereference twice, it's necessary to not write it twice. That's what led to this idea. I think it's consistant with other things in Perl such as how logical || returns the value rather than meer truth.

—John

  • Comment on Re: Re: optimization - exists should return a reference