ITADN

Suggestion to Support Both Pipe Operator Styles

#317Closedfierflame 创建于 2026-04-04
F
fierflamecommented
Why not consider supporting both pipe operator implementations simultaneously? To enable support for both approaches, here are two potential solutions: **Solution 1: Let the JS engine distinguish the style** The engine can determine which style is being used based on the presence of a placeholder (e.g., `%`). If a placeholder is present, the expression is parsed using the Hack style; otherwise, it defaults to the F# style. For example: ```javascript a |> b |> c + % |> d ``` This would be equivalent to: ```javascript d(c + b(a)) ``` **Solution 2: Use different operator symbols** Assign distinct operators to each style. For instance, use `|>` for the F# style and a different symbol (such as `|>>` or `||>`) for the Hack style. Under this approach, the example from Solution 1 would be written as: ```javascript a |> b |>> c + % |> d ``` Or alternatively: ```javascript a |> b ||> c + % |> d ```
关闭于 2026-04-25 6 条评论