04.02.2026 04:58, Morgan:
I'm wondering how this would relate to the function composition operator, noted in the follow-up RFC. Basically, would "return" make sense at the end of a function composition chain, and what sense would that be?

When $x |> f1(...) |> f2(...) |> f3(...);
is equivalent to (f1(...) + f2(...) + f3(...))($x);
[Aside: personally I find the suggested order of arguments backwards from every other instance of function composition I've encountered, but I suppose I could learn to live with it. But that's another subject.]

and $c = f1(...) + f2(...) + f3(...);
is equivalent to $c = fn($x) => ($x |> f1(...) |> f2(...) |> f3(...));

what happens when "f3(...)" is "return"? The intended behaviour is given for the first case but not for the others (not even the fourth, which is still the pipe operator).


Neither return nor pipe to return can appear inside an arrow function. So  `fn($x) => ($x |> f1(...) |> f2(...) |> return)` is invalid, same as `fn($x) => (return $x |> f1(...) |> f2(...))`

`$x |> f1(...) |> f2(...) |> return;` can be rewritten as `return (f1(...) + f2(...))($x)` or as `(f1(...) + f2(...))($x) |> return`.

Piping to return should not be perceived as a method of composition. It is some way of defining data flow, pipe here in plumbing meaning.  $x var goes to f1(), then to f2(), and then to sewerage (return).

Reply via email to