-
Notifications
You must be signed in to change notification settings - Fork 42
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
Fresh label #1148
Closed
Closed
Fresh label #1148
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
allow better printing
This reverts commit 49a9a61.
This reverts commit 5150615.
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Co-authored-by: Daniel Hillerström <daniel.hillerstrom@ed.ac.uk>
Superceded by #1169. |
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.
This grants the possibility to define local labels, ie labels that can only be used in a specific scope.
The user can define one or more local labels that will be bound in the scope with
He can use the local labels so defined in the scope as any other effect label and he cannot use them outside that scope.
A function, a value or a typename that has such a label in its type cannot escape the scope. When we leave the scope, we try to erase the label from the type and if it it possible (ie if the label as a polymorphic or absent presence) the function/value is available in the rest of the program, it's type being cleaned from any local label. Otherwise, the function/value/typename is removed from the context and trying to use it will cause an unknown variable or
Unbound type constructor
error.There's something that is still not perfect. The effectnames being inlined before typechecking, we can get a label going out of scope. This will be identified by the typechecker and will raise a
local label ... is not bound
error. It seems that the effectname has escaped the scope.Example
Briefly, here's how the code works :
Label.t
. They can be either global or local, have a name and the local ones have an id.fresh ... { ... }
binding, we add the labels into the context and typecheck each declaration in the scope.Remark
for now if all labels are internally of the same type and then can be local or global, the parser only accepts local labels in effect related things