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

Cleanup pipe: remove |.u and change "|." to "->" to represent pipe. #7244

Merged
merged 5 commits into from
Jan 14, 2025

Conversation

cristianoc
Copy link
Collaborator

@cristianoc cristianoc commented Jan 11, 2025

AST cleanup: remove "|." and rename "|." to "->" in the internal representation for the pipe operator.

@cristianoc cristianoc changed the title Cleanup pipe: remove |.u which is effectively treated the same as `… Cleanup pipe: remove |.u and change "|." to "->" to represent pipe. Jan 11, 2025
@cristianoc cristianoc requested review from cknitt and zth January 11, 2025 16:34
@cristianoc
Copy link
Collaborator Author

@cknitt @zth any idea if someone in a ppx might be relying on pipe being represented as "|."? Seems unlikely but just double checking.
As in that case, we might have to convert back and forth when calling a ppx. Which would be a time bomb anyway, as the problem would be pushed to when the new ast is adopted to ppxs.

@zth
Copy link
Collaborator

zth commented Jan 11, 2025

I think PPXes do rely on that, yes. So doing a transform would be good.

I envision all of the major PPXes in the ecosystem moving to the proper ReScript AST once we've cleaned it up and are ready for consumption.

Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

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

Looks great! Just the question about the PPX transform.

@cknitt
Copy link
Member

cknitt commented Jan 13, 2025

Nice! I also think that we should transform to |. for PPXs using the "v0 AST".

@cknitt
Copy link
Member

cknitt commented Jan 13, 2025

BTW what about the other operators here?

  let printBinaryOperator = (~inlineRhs, operator) => {
    let operatorTxt = switch operator {
    | "|." => "->"
    | "^" => "++"
    | "=" => "=="
    | "==" => "==="
    | "<>" => "!="
    | "!=" => "!=="
    | txt => txt
    }
    ...

Should we also change them in the AST?

@cristianoc cristianoc merged commit 43389c9 into master Jan 14, 2025
20 checks passed
@cristianoc cristianoc deleted the cleanup-pipe branch January 14, 2025 12:30
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.

3 participants