Conversation
According to mops_one, the base library was taken from https://github.com/dfinity/motoko/releases. |
ByronBecker
left a comment
There was a problem hiding this comment.
@f0i Thanks for this PR and work!
This is a huge PR, so it's going to take me a bit of time to go through everything.
Two suggestions that would make this a whole lot easier on my end to review would be:
- Split this into 4-5 different small PRs. Put 15 functions in each one, and I'll review promptly. We should finish in 1-2 weeks.
- Match up the diffs, so that previously existing functions are in the same order at the top, and everything new comes after it below (I can review functions side by side).
| var _size : Nat; // avoid name clash with `size()` method | ||
| var elements : [var ?X]; |
There was a problem hiding this comment.
This is a complete breaking change with the StableBuffer type. Since this is now stable, the inner properties are expected to be the same name before & after upgrade.
Can you revert this to keep the original property names?
This applies to everywhere else that initCapacity, count, and elems are referenced in the PR.
There was a problem hiding this comment.
I guess the alternative is that we release a StableBufferV2 repo, which is recommended as it is more in sync with the one in base. That actually might be easier, and then we don't break people.
|
I'll close this one and create separate pull requests as recommended above. The first one is #11 which updates the functions that already existed in the previous version. Also, the StableBuffer type will be identical to the previous version of StableBuffer to maintain backward compatibility. |
I updated the StableBuffer based on the current version 0.8.7 published on MOPS.
There is currently no tag for 0.8.7 in dfinity/motoko-base so it could also be 0.8.6 🤔. Anyway, the version in HEAD matches the one published with MOPS, and the one now in
reference/Buffer.mo.Test cases have been slightly changed to reflect the new capacity expansion factor of 1.5x.
Code has been formatted by the official Motoko VS-Code plugin/formatter which unfortunately causes a noisy diff.
I could attempt to create a distinct commit for the formatting if it poses an issue. However, if it's not a concern for you, I won't invest time in it.