On Thu, Jul 21, 2016 at 2:56 PM, Rowan Collins <rowan.coll...@gmail.com> wrote: > On 21/07/2016 22:28, Sara Golemon wrote: >> >> Are you picturing the return statement returning from the current >> function? Or "returning" from the current pipe chain? >> >> I think you mean the former, in which case I'd ask how that'd better/worse >> than: >> >> return foo() |> bar($$); > > I do indeed mean returning from the current function. I went into more > detail (perhaps too much!) on the previous thread, but the basic premise is > the pipe operator gives you code that reads left to right. Adding an element > where you have to jump back to the beginning of the expression feels like it > defeats that. > Ah! I understand your point now. Indeed, in terms of code-scan, there's something of a whiplash effect going on. Now I understand the motivation behind $> assignment and/or using a terminal like `return $$` at the end.
Adding in support for some terminals (like return) could make sense, it's an exception to a rule, but it's a reasonable looking one (at first glance, anyway). The assign to var at the end however, is something I'd rather handle with the following: foo() |> bar($$) |> $baz = qux($$); Which is both legal with the syntax as-is, and entirely readable without adding an extra operator. -Sara -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php