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

Newtypes #1015

Merged
merged 16 commits into from
Jan 13, 2021
Merged

Newtypes #1015

merged 16 commits into from
Jan 13, 2021

Conversation

robdockins
Copy link
Contributor

We've had partial support for a while now for a newtype construct, but that support was never fully fleshed out. This PR is for completing the job, writing associated documentation, test cases, etc.

CF #870

@robdockins robdockins force-pushed the newtypes branch 4 times, most recently from 298e2cc to 0264ada Compare December 23, 2020 18:14
@robdockins
Copy link
Contributor Author

@pnwamk, @david-christiansen, There are some nontrivial questions about how to represent values of newtypes in the cryptol remote API, and I'd love you have your opinions about what we should do here.

@robdockins
Copy link
Contributor Author

@yav, @brianhuffman, aside from the questions about the remote API, I think this PR is ready to go.

@robdockins robdockins marked this pull request as ready for review December 24, 2020 21:03
@david-christiansen
Copy link
Contributor

Can we have a video chat about it in the first week of January? Just so there's time to go back and forth a bit about what the feature is used for and its history so we can pick the right trade-offs.

@robdockins
Copy link
Contributor Author

Can we have a video chat about it in the first week of January? Just so there's time to go back and forth a bit about what the feature is used for and its history so we can pick the right trade-offs.

Sure, I'll set something up.

Copy link
Member

@yav yav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only looked at the diff on github, so not in a lot of detail, but it looks reasonable to me.

In the longer run we may want to represent newtypes with a single field a bit more efficiently, but let's worry about that if it every comes up. I'd say merge it in, this way we'll get to test it by using it.

r = x.real * y.real - x.imag * y.imag
i = x.real * y.imag + x.imag * y.real

cplxEq : CplxQ -> CplxQ -> CplxQ
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self : should be cplxEq : CplxQ -> CplxQ -> Bit


At runtime, newtypes values are represented in exactly
the same was as records. The constructor function for
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was -> way

the fields of the newtype body, and push newtypes into
various parts of the evaluator, random testing, etc.
and use `TValue` instead of `Type` in more places.
in scope.  Also, demote the `NewtypeEnv` to a type synonym, as the
newtype was just annoying.
of `Type`.  This allows us to directly carry the `Newtype`
instead of having to look it up in a table at use sites.
functions.  Newtype information is now propigated directly
into types via the typechecker instead of being looked up
separately.
make it responsive to the `show-examples` option.
@robdockins robdockins merged commit f55aea6 into master Jan 13, 2021
@robdockins robdockins mentioned this pull request Jan 15, 2021
brianhuffman pushed a commit to GaloisInc/saw-core that referenced this pull request Jan 28, 2021
brianhuffman pushed a commit to GaloisInc/saw-script that referenced this pull request Jan 28, 2021
@RyanGlScott RyanGlScott deleted the newtypes branch March 22, 2024 14:47
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.

None yet

3 participants