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
In Noir, arrays are cloned when moved into another variable:
letmut a = [1,2,3];let b = a;
a[0] = 5;assert(a[0] == 5);assert(b[0] == 1);
However the SSA refactor currently does not clone them, instead arrays function more as references:
letmut a = [1,2,3];let b = a;
a[0] = 5;// Assuming this was compiled with the new ssa refactor this would hold currentlyassert(a[0] == 5);assert(b[0] == 5);
Proposed solution
Add a check when creating new variables to clone arrays.
Alternatives considered
Alternatively, change arrays to have some immutable representation that does not need to be cloned manually. An example representation would be im::Vector which would also allow us to grow these arrays.
Additional context
No response
Submission Checklist
Once I hit submit, I will assign this issue to the Project Board with the appropriate tags.
The text was updated successfully, but these errors were encountered:
Alternatively, change arrays to have some immutable representation that does not need to be cloned manually. An example representation would be im::Vector which would also allow us to grow these arrays.
This is done now, we use im::Vector for all arrays in SSA.
Problem
In Noir, arrays are cloned when moved into another variable:
However the SSA refactor currently does not clone them, instead arrays function more as references:
Proposed solution
Add a check when creating new variables to clone arrays.
Alternatives considered
Alternatively, change arrays to have some immutable representation that does not need to be cloned manually. An example representation would be
im::Vector
which would also allow us to grow these arrays.Additional context
No response
Submission Checklist
The text was updated successfully, but these errors were encountered: