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

feat: Simplify pipe / eliminate $input #353

Open
bjchambers opened this issue May 10, 2023 · 0 comments
Open

feat: Simplify pipe / eliminate $input #353

bjchambers opened this issue May 10, 2023 · 0 comments
Labels
enhancement New feature or request p2 Good to have improvements sparrow

Comments

@bjchambers
Copy link
Collaborator

Summary
Currently, <a> | <b> is implemented as let $input = <a> in <b>, with some special rules for inferring $input for ommitted arguments. This allows for interesting uses -- such as referencing the left hand side in a deeply nested location on the right hand side.

A simpler approach inspired by PRQL would be to have a simple rule like <a> | f(<b...>) always becomes f(<b...>, <a>) (the left hand side becomes the last argument to the function on the right.

This would allow us to:

  1. Eliminate the rules for inferring $input as an argument. In turn, this would simplify error messages when an argument is missing (instead of inferring $input and then reporting it isn't used).
  2. Simplify the rules for implementing pipe.
  3. Eliminate the concept of $input from what we need to document (in favor of the simpler explanation of pipe). Any examples that need it can be re-written (and likely clarified) using an explicit let binding and name.
  4. Eliminate the case of the left hand side of a pipe not being used.
@bjchambers bjchambers added enhancement New feature or request sparrow labels May 10, 2023
@epinzur epinzur added the p2 Good to have improvements label May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p2 Good to have improvements sparrow
Projects
None yet
Development

No branches or pull requests

2 participants