On Tue, 30 Jul 2002, Dan Sugalski wrote:
> I need to get Larry to nail some things down. On the one hand, he's
> said that chained comparisons evaluate their parameters just once.
> That argues for moving the values to N or S registers.

I read that as "expressions are evaluated once", not "PMC's are accessed
once".  So something like

    2 < $i++ < 23

will do the expected -- increment $i once, keeping the result in a PMC
temporary.  The temp will necessarily be accessed more than once, but to
me that doesn't count as evaluating the expression multiple times.

> On the other, comparisons are overloadable, which means we need to
> call the PMC's vtable entries.

That gets us into that mess.  But we can still evaluate the expression to
a PMC temporary, then get its value more than once.  And if you've tied a
variable to have side effects every time it's accessed, you shouldn't care
if the results are unpredictable.

/s

Reply via email to