Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Precedence of |> #11

@nicolo-ribaudo

Description

@nicolo-ribaudo

On the left, |> is as tight as assignment operators. This allows parsing x = y |> z as x = (y |> z), and x ? y : z |> w as (x ? y : z) |> w.

On the right, there are two options:

  1. |> PipeExpression
  2. |> AssignmentExpression

(2) matches the precedence of =>, which is the most similar operator to |> (they both take something on their left and put it in the expression on their right). It also allows thinks like x |> res = % and x |> () => %. However when used in longer chains, x |> y = % |> f(%) would be parsed as x |> (y = % |> f(%)) and not as x |> (y = %) |> f(%).

(1) disallows unparenthesized assignments and arrows on the right of |>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions