Motoko Base Library Changes

Earlier today, we talked about the idea of wrapping the management canister into the base library, and the decision was to defer this to separate Mops packages. The reasoning is that the version of the management / ledger canisters can change independently of Motoko, which could make things tricky for developers using previous versions of the compiler.

At the moment, it’s possible to do this with @ZenVoich’s ic and ledger-types Mops packages. This import syntax is also available as another way to access the management canister.

This is also a great point and seems reasonable to include in the base library. I can’t make any promises about it happening in the next version, but I’ll at least make sure it’s included in the backlog so we can find a good solution for this.

I agree, and we are including a List data structure with similar functionality to lists in Python, Java, C#, and vectors in C++ / Rust. JavaScript’s array implementation is a bit of an outlier (since it’s usually a list behind the scenes rather than a true array), but we are doing our best to make the API as familiar as we can for JS developers.

In the next base library version, we are adding a mutable deque (mo:base/Queue) while keeping the purely functional API available by importing mo:base/immutable/Queue. This pattern will also apply to all of the other data structures in the base library.

@michael-weigelt, does this answer your question? Otherwise, let me know and I’d be happy to go into further detail.

3 Likes