You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noir has mutable variables, but they are strictly local: no mutation can be observed across function boundaries. This leads to code like the following:
However, adding first-class references comes with a host of problems. Namely, tracking the references as they are passed around everywhere, stored in structs, arrays, or returned from functions can become trouble-some. To alleviate this, we should only add second-class references to Noir. Second-class references will not be allowed to be stored within structs or arrays, and can only be used essentially as a parameter-passing mode. This way our existing analysis for references will suffice while still gaining us some increased ergonomics.
Alternatives Considered
No response
Additional Context
No response
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:
Problem
Noir has mutable variables, but they are strictly local: no mutation can be observed across function boundaries. This leads to code like the following:
Happy Case
If references were added,
BoundedVec::push
could take a mutable reference to the vector and the code could be simplified to the more natural:However, adding first-class references comes with a host of problems. Namely, tracking the references as they are passed around everywhere, stored in structs, arrays, or returned from functions can become trouble-some. To alleviate this, we should only add second-class references to Noir. Second-class references will not be allowed to be stored within structs or arrays, and can only be used essentially as a parameter-passing mode. This way our existing analysis for references will suffice while still gaining us some increased ergonomics.
Alternatives Considered
No response
Additional Context
No response
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: