-
Notifications
You must be signed in to change notification settings - Fork 110
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
Adding update and extend type support for data types #1255
base: horizon
Are you sure you want to change the base?
Conversation
| bar(a :: Number, ref b :: String) | ||
end | ||
|
||
bar(1, "a").{a: "a"} |
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.
Are these test cases named correctly? This doesn't seem to be a missing field, it's a wrong type. In general, could you add a comment to each bad test, above the failing expression, explaining what the error should be?
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.
Oops I flipped two of the test files for both update and extend.
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.
This looks almost right...but you forgot to fix this specific file. After that, I'm good to merge this.
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.
I have fixed it now.
Thanks -- just to confirm: it is a design goal of the type checker to disallow adding fields to data values, right? If so, I'm good to merge... |
That is correct. |
Wow, we got static support for this feature before dynamic support is fully baked. Currently, update of existing fields does weird things dynamically, as does adding new fields. #835 is currently an error. See: https://github.com/orgs/brownplt/teams/pyret/discussions/8 I think we need a decision on the desired dynamic semantics of this before we can start blessing programs as typed. |
Allows extend and update syntax to be used on data types.
Errors if the fields do not occur in the data type, e.g.