Skip to content

0.14.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 05 Feb 08:37
· 4 commits to master since this release
b0123f5
  • motoko (moc)

    • Add .values() as an alias to .vals() for arrays and Blobs (#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 to length,
      and change its type from Nat32 to Nat.

      See the documentation for full details.