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

Fix immediately called (op) in pipeline context #1677

Merged
merged 1 commit into from
Jan 5, 2025
Merged

Conversation

edemaine
Copy link
Collaborator

@edemaine edemaine commented Jan 5, 2025

Fixes #1672

@edemaine edemaine force-pushed the binary-op-unary-arg branch from a295e94 to 66d8440 Compare January 5, 2025 17:18
@edemaine edemaine changed the title Fix (op) called with single argument, in pipeline context Fix immediately called (op) in pipeline context Jan 5, 2025
---
foo |> (+) x
---
(x)(foo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that the desired result?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, (+) x instantly unwraps, it’s not a section

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's perfect, but the current behavior is that (+) can be followed by any number of arguments, and they get added together. In the special case of 1, it's not very useful, but maybe helpful in a setting where you're adding/removing arguments like so:

(+)
  part1
  part2
//edit from/to:
(+)
  part1
  //part2

(similar to how we support empty blocks in if etc.)

@edemaine edemaine merged commit aa8b8c1 into main Jan 5, 2025
4 checks passed
@edemaine edemaine deleted the binary-op-unary-arg branch January 5, 2025 17:57
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.

Compiler barfs on foo |> (*) bar
3 participants