-
motoko (
moc
)-
Add
.values()
as an alias to.vals()
for arrays andBlob
s (#4876). -
Support explicit, safe migration of persistent data allowing arbitrary
transformations on a selected subset of stable variables.
Additional static checks warn against possible data loss (#4812).As a very simple example:
import Nat32 "mo:base/Nat32"; (with migration = func (old : { var size : Nat32 }) : { var length : Nat } = { var length = Nat32.toNat(old.size) } ) persistent actor { var length : Nat = 0; }
may be used during an upgrade to rename the stable field
size
tolength
,
and change its type fromNat32
toNat
.See the documentation for full details.
-