Conversation
✅ Deploy Preview for noir-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
I am not sure that all slice methods are array methods when using the flag. But I was chatting with @vezenovm and he said that once the experimental-ssa flag is the default, this will be the case. I am not sure if there are other changes that will be in the 0.9.0 release that will make this happen. |
How I understand it is:
Rust often offers a wide set of possible nuances for devs to pick the best option for quick development vs safety & optimizations. Hope it helps and happy to be corrected 🙌 |
|
Hey @critesjosh @signorecello so after this PR: noir-lang/noir#2070, arrays and slices no longer have a subtyping relationship. On Noir master you will see that the array methods and slice methods are now separated again in the stdlib. There is now an This isn't a breaking change though as we automatically coerce arrays to slices in the compiler when needed. Here is a simple example: fn foo(slice: [Field]) -> comptime Field {
slice.len();
}
fn bar() {
let arr = [0; 5];
assert(foo(arr) == 5);
}Apologies for the back-and-forth here, but removing the subtype relationship between slices and arrays was deemed the best solution as it solved some other issues for us. |
closes #231
Even to me, it's confusing the whole Array/Slices/Vector thing, but @critesjosh you're telling me that with the
--experimental-ssaall slice methods will be array methods, maybe it would help with this?