Skip to content

0.8.3

Compare
Choose a tag to compare
@github-actions github-actions released this 24 Feb 16:39
· 343 commits to master since this release
73330dd
  • motoko (moc)

    • new 'let-else' construct for handling pattern-match failure (#3836).
      This is a frequently asked-for feature that allows to change the control-flow
      of programs when pattern-match failure occurs, thus providing a means against
      the famous "pyramid of doom" issue. A common example is look-ups:

      shared func getUser(user : Text) : async Id {
        let ?id = Map.get(users, user) else { throw Error.reject("no such user") };
        id
      }

      Similarly, an expression like

      (label v : Bool { let <pat> = <exp> else break v false; true })

      evaluates to a Bool, signifying whether <pat> matches <exp>.

    • Improve recursive deserialization capacity to match recursive serialization capacity by reducing
      Wasm stack consumption (#3809).
      Because of the bounds on recursion depth imposed by fixed-size stack, the
      advice remains the same: avoid deeply nested recursive data structures.
      Think "shallow trees good, very long lists bad".

    • bugfix: stack overflow in UTF-8 encode/decode for moc.js (#3825).

  • motoko-base

    • add missing unshare : Tree<K, V> -> () method to class RBTree<K, V>
      to restore objects from saved state (dfinity/motoko-base#532).