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

Backport upstream parser changes about function arity #2401

Closed
Julow opened this issue Jul 17, 2023 · 2 comments
Closed

Backport upstream parser changes about function arity #2401

Julow opened this issue Jul 17, 2023 · 2 comments
Assignees

Comments

@Julow
Copy link
Collaborator

Julow commented Jul 17, 2023

ocaml/ocaml#12236 has been merged in ocaml and contains changes to the parsetree.
The changes are helping the work on the CST (#2213).

This requires some more changes: (thanks @ncik-roberts for the heads up)

  • fun x -> fun y -> must no longer be rewritten to fun x y ->, as the two have different semantics.
  • fun x -> function y -> x + y is also different from fun x -> (function y -> x + y). so parens around function are now meaningful.

@ncik-roberts adds:

In the case where the programmer writes fun x -> fun y -> x + y, it might be nice to visually exaggerate the fact that the inner function is separate now, with something like fun x -> (fun y -> x + y). (Now that this PR is merged, fun x -> fun y -> x + y has different runtime characteristics than fun x y -> x + y, where the former is an arity-1 function returning an arity-1 function, and the latter is an arity-2 function.)

@Julow
Copy link
Collaborator Author

Julow commented Apr 18, 2024

Draft PR: #2544

@Julow
Copy link
Collaborator Author

Julow commented Oct 14, 2024

Done in #2544

@Julow Julow closed this as completed Oct 14, 2024
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

No branches or pull requests

2 participants