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

Implement and use a new RecordMap type #786

Merged
merged 4 commits into from
Jun 30, 2020
Merged

Implement and use a new RecordMap type #786

merged 4 commits into from
Jun 30, 2020

Conversation

robdockins
Copy link
Contributor

This type stores records as a finite map from field names to
values, while also remembering the original order of the fields
from when the record was generated (usually, from the program source).
For all "semantic" purposes, the fields are treated as appearing in
a canoical order (in sorted order of the field names). However, for
user display purposes, records are presented in the order in which
the fields were originally stated.

In the course of implementing this, I discovered that we were not
previously checking for repeated fields in the parser or typechecker,
which would result in some rather strange situations and could probably
be used to break the type safety. This is now fixed and repeated fields
will result in either a parse error or a panic (for records generated
internally).

Fixes #706

@robdockins robdockins requested a review from brianhuffman June 26, 2020 23:49
src/Cryptol/Eval.hs Outdated Show resolved Hide resolved
@brianhuffman
Copy link
Contributor

Overall, this looks great. Most of the files you had to change look better than before, both more concise and more directly expressing the code's intent. Thanks @robdockins for doing this!

This type stores records as a finite map from field names to
values, while also remembering the original order of the fields
from when the record was generated (usually, from the program source).
For all "semantic" purposes, the fields are treated as appearing in
a canoical order (in sorted order of the field names).  However, for
user display purposes, records are presented in the order in which
the fields were originally stated.

In the course of implementing this, I discovered that we were not
previously checking for repeated fields in the parser or typechecker,
which would result in some rather strange situations and could probably
be used to break the type safety. This is now fixed and repeated fields
will result in either a parse error or a panic (for records generated
internally).

Fixes #706
@robdockins robdockins merged commit ea5508a into master Jun 30, 2020
brianhuffman pushed a commit to GaloisInc/saw-script that referenced this pull request Jul 2, 2020
Also update cryptol-verifier and saw-script to adapt to cryptol changes.
@RyanGlScott RyanGlScott deleted the record-maps branch March 22, 2024 14:44
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.

Map representation for record types
2 participants