Hi

On 2/8/25 12:36, Tim Düsterhus wrote:
If the expression on the right side that produces a Closure has side effects 
(output, DB interaction, etc.), then the order in which those side effects 
happen may change with the different restructuring.

That is a good point. I see you added a precedence section, but this
does not fully explain the order of operations in face of side-effects
and more generally with regard to “short-circuiting” behavior. An OPcode
dump would explain that.

Specifically for:

      function foo()     { echo __FUNCTION__, PHP_EOL; return 1; }
      function bar()     { echo __FUNCTION__, PHP_EOL; return false; }
      function baz($in)  { echo __FUNCTION__, PHP_EOL; return $in; }
      function quux($in) { echo __FUNCTION__, PHP_EOL; return $in; }

      foo()
          |> (bar() ? baz(...) : quux(...))
          |> var_dump(...);

What will the output be?

This is unresolved.

Best regards
Tim Düsterhus

Reply via email to