-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add tuples to the surface language, allow tuples for argument passing #554
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No helpers to destruct them at the moment
As part of making tuples first-class citizens, expliciting the arity upon function application was needed (so that a function of two args can transparently -- in the surface language -- be applied to either two arguments or a pair). It was decided to actually explicit the whole type of arguments because the cost is the same, and this is consistent with lambda definitions. A related change done here is the replacement of the `EOp` node for operators by an "operator application" `EAppOp` node, enforcing a pervasive invariant that operators are always directly applied. This makes matches terser, and highlights the fact that the treatment of operator application is almost always different from function application in practice.
denismerigoux
approved these changes
Jan 3, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much @AltGr! As always, a few benign remarks before merging but this is excellent work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upon adding tuples to the surface language, we wanted to ensure that, at least
on surface, there was no difference between applying a function to a pair or to
two arguments.
Technically, defining a function of a pair is forbidden (and not syntactically
possible), and during conversion to
scopelang
, we process with de-tuplification offunction arguments when needed. This transformation is based on typing
information that is of the same kind as what is used for overload resolution.
Towards this purpose, explicit types have been added to application nodes in the
AST ; besides and for convenience, the application of operators is split into a
different
EAppOp
node, replacing the plainEOp
node.