Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstring of |>: add parentheses around -> func #43699

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

tfiers
Copy link
Contributor

@tfiers tfiers commented Jan 7, 2022

This clarifies the current behaviour where the subsequent pipes get parsed as part of the anonymous function's body if there are no parentheses.

The current line

[1:5;] |> x->x.^2 |> sum |> inv

is parsed as

[1:5;] |> x -> (x.^2 |> sum |> inv)

but it feels like the author meant (and readers would expect)

[1:5;] |> (x->x.^2) |> sum |> inv

This PR makes this explicit.

See also #38761 and #43661.

@aviatesk aviatesk merged commit 4f1ff0b into JuliaLang:master Jan 7, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants