-
Notifications
You must be signed in to change notification settings - Fork 226
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 a derive
attribute with support for (de)serialize macros on existing complex types
#3379
Comments
Reassigning to |
I think we should wait until after we have traits for this. We'll likely want the |
Thanks @jfecher, added Traits as a blocker of this Issue. |
@kevaundray @jfecher would you anticipate this to be considerably more complex to implement versus #2240? (Otherwise seems like this could supersede that.) |
@jfecher when will Noir start using traits? Aren't they already at least experimental? I remember Kev saying we could use them in sandbox land |
@rahul-kothari no official time on them yet since they're still experimental. They're in the compiler already for the most part but you'll receive warnings if you try to use them as there are still some missing features and edge cases. Most notably I'm working now to add support for generics to traits which is important since generics are required for even something as simple as equality on arrays. You may be fine using them now if you're alright with the warnings and limit yourself to only non-generic types on non-generic traits. ETA for generics is... perhaps roughly 1 month's time. |
@Savio-Sou I suppose adding a |
We have We can't implement this deriver function in Noir's stdlib since we don't define Serialize or Deserialize there either - that will be work for the authors of those libraries. Since it should be possible now, I'm closing this issue. |
Blocked by
Problem
@rahul-kothari brought up that Noir does not currently have a canonical way of (de)serializing all types (including custom structs), hence users have to write their own custom methods to achieve so.
An example of such custom method in Aztec.nr.
Happy Case
@kevaundray suggested we could add a
derive
attribute similar to Rust with support of derive macros.For this GitHub Issue, we can aim at:
#[derive(serialize)]
and#[derive(deserialize)]
P.S. Pardon my lack of knowledge in Rust. If the scope does not make sense, definitely comment below.
Support for e.g. additional derive macros, custom derive macros definable by users can be added later with separate issues.
Alternatives Considered
No response
Additional Context
@kevaundray noted that his might not necessarily be the best solution for the problem if the serialization needs to be duplicated in another language like TypeScript.
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: