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

Add "requires binary" flag to opdef signatures. #1361

Closed
Tracked by #1344
ss2165 opened this issue Jul 25, 2024 · 3 comments · Fixed by #1371
Closed
Tracked by #1344

Add "requires binary" flag to opdef signatures. #1361

ss2165 opened this issue Jul 25, 2024 · 3 comments · Fixed by #1371
Assignees

Comments

@ss2165
Copy link
Member

ss2165 commented Jul 25, 2024

Operations in Extension declarations can state one of:

  • An explicit type scheme
  • A type scheme + a flag indicating binary required for validation, in-memory extensions should point to this function.
  • A flag indicating code required to compute the type scheme, in-memory extensions should point to this function.
@acl-cqc
Copy link
Contributor

acl-cqc commented Jul 29, 2024

How do I interpret this? Does this describe the current situation, or the desired state? If the latter, which bits are new?

Looking at the current op_def.rs, I note we use struct CustomValidator for every case where we have a PolyFuncType, even if there is no custom binary code - that seems undesirable, and the name is misleading (CustomValidator does not necessarily include any custom validation code!). I'd suggest:

pub enum SignatureFunc {
  //PolyFuncType(CustomValidator) // i.e., remove this, replace with:
  PolyFuncType(PolyFuncTypeRV, Option<Box<dyn ValidateTypeArgs>>),
 CustomFunc(Box<dyn CustomSignatureFunc>) // unchanged
}

However not clear how this relates to the issue here. A second possible goal is to replace each of the Box<dyn>s with an Option where None means "binary code require but absent", which is distinct from a None custom-validation (no validation required)....

@acl-cqc
Copy link
Contributor

acl-cqc commented Jul 29, 2024

Ah, or does this just relate to serialization format?

@ss2165
Copy link
Member Author

ss2165 commented Jul 29, 2024

this relates to just serialised yeah, I've been thinking of those as "declarations" (as opposed to "definitions" that may be backed by executable code)

github-merge-queue bot pushed a commit that referenced this issue Jul 30, 2024
Fear not the diff, mostly schema update.


- Define a Pydantic model and serialised schema for extensions.
- Update the rust `SignatureFunc` serialisation to be compatible with
this.
- Serialized extension "declarations" can state they require binary
compute or validation functions. `SignatureFunc` reports this if they
are missing, and it is up to the caller (typically validation) to decide
how to recover from this.

Closes #1360 
Closes #1361

Addresses parts of #1228 

Best reviewed as individual commits.

BREAKING CHANGE: `TypeDefBound` uses struct-variants for serialization.
`SignatureFunc` now has variants for missing binary functions, and
serializes in to a new format that indicates expected binaries.
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 a pull request may close this issue.

2 participants