-
Notifications
You must be signed in to change notification settings - Fork 5
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
CustomTypeArg
should hold a Value
#1308
Comments
Discussed this quite a bit with @ss2165. Thoughts
This leads to a design space including options like....
|
Closes #1308 - Previously held a yaml value, this doesn't really make much sense - If it is an opaque blob, no reason it needs a HUGR custom type attached to it? - Now truly opaque, it is up to extension-aware tooling to use the bytes data as they see fit - Serialised as base64 encoded string - Utilities for common case, strings - Conducive with adding typed "operation intrinsics/properties" as a follow-up. This would be hugr-typed values that can be attached to operations (in a semantically significant manner, unlike metadata) but perhaps are not allowed to affect the signature. - should there be a cap on size of byte array? If so should we use `[u8; N]` over `Vec<u8>`? - Serialisation break to be handled TODO BREAKING_CHANGE: opaque type arguments are now untyped and hold bytes rather than a yaml value. Serialised form is base64 string.
Closes #1308 - Previously held a yaml value, this doesn't really make much sense - If it is an opaque blob, no reason it needs a HUGR custom type attached to it? - Now truly opaque, it is up to extension-aware tooling to use the bytes data as they see fit - Serialised as base64 encoded string - Utilities for common case, strings - Conducive with adding typed "operation intrinsics/properties" as a follow-up. This would be hugr-typed values that can be attached to operations (in a semantically significant manner, unlike metadata) but perhaps are not allowed to affect the signature. - should there be a cap on size of byte array? If so should we use `[u8; N]` over `Vec<u8>`? - Serialisation break to be handled TODO BREAKING_CHANGE: opaque type arguments are now untyped and hold bytes rather than a yaml value. Serialised form is base64 string.
Closes #1308 - Previously held a yaml value, this doesn't really make much sense - If it is an opaque blob, no reason it needs a HUGR custom type attached to it? - Now truly opaque, it is up to extension-aware tooling to use the bytes data as they see fit - Serialised as base64 encoded string - Utilities for common case, strings - Conducive with adding typed "operation intrinsics/properties" as a follow-up. This would be hugr-typed values that can be attached to operations (in a semantically significant manner, unlike metadata) but perhaps are not allowed to affect the signature. - should there be a cap on size of byte array? If so should we use `[u8; N]` over `Vec<u8>`? - Serialisation break to be handled TODO BREAKING_CHANGE: opaque type arguments are now untyped and hold bytes rather than a yaml value. Serialised form is base64 string.
I mostly agree with Alan above, I was of the view that it is important to retain the ability for I do think static Use case for We will need to support |
I agree. Should we be attaching this to nodes or rely on our existing infrastructure for this - i.e. all ops can have static edges? Another idea: add a value->static op that has to be removed at runtime, potentially gives us way more powerful constexpr handling? (I think Zig does this by emulating the target but how we actually implement the evaluation is not important here I think) |
...and computes a type from it? Yeah, ugh, I mean, we ought to have some backdoor way to do that - it does not necessarily have to be nice or easy... For example, having to pass the desired FunctionType as well as the "ad-hoc JSON", would be fine, but I'd still want to be able to call extension code to validate that the FunctionType is correct wrt. the JSON, and since the I love @ss2165's "take extra Static args" approach but that doesn't get any extra data into |
Lots of nice follow ups from the discussion above, but for now I'm going with replacing OpaqueArg with a string, and that should be addressing the original issue. |
Closes #1308 - Previously held a yaml value, this doesn't really make much sense - If it is an opaque blob, no reason it needs a HUGR custom type attached to it? - Now truly opaque, it is up to extension-aware tooling to use the bytes data as they see fit - Serialised as base64 encoded string - Utilities for common case, strings - Conducive with adding typed "operation intrinsics/properties" as a follow-up. This would be hugr-typed values that can be attached to operations (in a semantically significant manner, unlike metadata) but perhaps are not allowed to affect the signature. - should there be a cap on size of byte array? If so should we use `[u8; N]` over `Vec<u8>`? - Serialisation break to be handled TODO BREAKING_CHANGE: opaque type arguments are now untyped and hold bytes rather than a yaml value. Serialised form is base64 string.
Closes #1308 BREAKING CHANGE: opaque type parameters replaced with string parameters.
Discussion on static-edge parameters moved to #1342 |
🤖 I have created a release *beep* *boop* --- ## [0.5.0](hugr-py-v0.4.0...hugr-py-v0.5.0) (2024-07-29) ### ⚠ BREAKING CHANGES * Eq type bound removed. References to `Eq` in serialized HUGRs will be treated as `Copyable`. * **hugr-core:** All Hugrs serialised with earlier versions will fail to deserialise * opaque type parameters replaced with string parameters. ### Features * **hugr-py:** `AsCustomOp` protocol for user-defined custom op types. ([#1290](#1290)) ([1db43eb](1db43eb)) * remove the `Eq` type bound. ([#1364](#1364)) ([1218d21](1218d21)) * replace opaque type arguments with String ([#1328](#1328)) ([24b2217](24b2217)), closes [#1308](#1308) * Serialization upgrade path ([#1327](#1327)) ([d493139](d493139)) ### Bug Fixes * add op's extension to signature check in `resolve_opaque_op` ([#1317](#1317)) ([01da7ba](01da7ba)) * **hugr-core:** bump serialisation version with no upgrade path ([#1352](#1352)) ([657cbb0](657cbb0)) * **hugr-py:** ops require their own extensions ([#1303](#1303)) ([026bfcb](026bfcb)), closes [#1301](#1301) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Currently
CustomTypeArg
holds aserde_yaml::Value
payload. We want to change this to aserde_json::Value
#1048 , I suggest instead we should change it tocrate::ops::custom::Value
The text was updated successfully, but these errors were encountered: