Add extra front-end types and make MainPodBuilder emit these#166
Merged
Add extra front-end types and make MainPodBuilder emit these#166
Conversation
694a8b4 to
84d75fa
Compare
ax0
approved these changes
Mar 26, 2025
src/examples/custom.rs
Outdated
| STB::new(NP::ValueOf) | ||
| .arg(("attestation_pod", literal(KEY_TYPE))) | ||
| .arg(PodType::MockSigned), // TODO | ||
| .arg(Value::from(middleware::Value::from(PodType::MockSigned))), // TODO |
Collaborator
There was a problem hiding this comment.
These Value type conversions are getting out of hand.
84d75fa to
fac4ee7
Compare
ed255
approved these changes
Apr 7, 2025
src/examples/custom.rs
Outdated
| STB::new(NP::ValueOf) | ||
| .arg(("attestation_pod", literal(KEY_TYPE))) | ||
| .arg(PodType::MockSigned), // TODO | ||
| .arg(Value::from(middleware::Value::from(PodType::MockSigned))), // TODO |
Collaborator
There was a problem hiding this comment.
Suggested change
| .arg(Value::from(middleware::Value::from(PodType::MockSigned))), // TODO | |
| .arg(middleware::Value::from(PodType::MockSigned)), // TODO |
This also works, and it's a bit shorter.
But I agree with @ax0 that maybe the From implementations between types of the same name in frontend and middleware may be making the code harder to follow.
Collaborator
There was a problem hiding this comment.
I'll explore enriching the middleware types with "metadata" so that we can avoid duplicating so many types in the frontend. #171
| impl Origin { | ||
| pub fn new(pod_class: PodClass, pod_id: PodId) -> Self { | ||
| Self { pod_class, pod_id } | ||
| pub fn new(pod_id: PodId) -> Self { |
Collaborator
There was a problem hiding this comment.
maybe we can remove the Origin type altogether?
Collaborator
There was a problem hiding this comment.
I suggest we leave this for the refactor #171 so that we can move on with this PR now.
This file contains hidden or 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
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.
Closes #161
In order to allow for serialization of front-end versions of Custom Statements, it's necessary to include the definition of the matching Custom Deduction. This PR adds front-end types for custom predicate definitions, including statement templates.
Unfortunately this leads to some duplication of code already implemented in the middleware, for example for wildcard matching. This is needed in the front-end for
MainPodBuilder, but the compiler also needs a version of the same thing forOperation::check. It's not a huge amount of code, but there is some risk that we change how the middleware works without changing how the front-end works, or vice versa. If we're intending to do a larger tidy-up of the code later then maybe we can decide what to do about this then.