0.6.18
Highlights of what’s new in 0.6.18
The 0.6.18 release primarily includes user-visible new features, internal enhancements, and fixes and updates to the version of Motoko and, the Motoko base library that are supported, and Candid.
The most significant new features and fixes include the following updates:
-
A fix to
dfx upgradethat prevents amainthread panic whenOption::unwrap()is called on aNonevalue. -
A fix to the name of the language service command to restore its compatibility with IDEs.
Motoko
-
New syntax for option types: Option blocks
do ? <block>and option checks<exp> !.Inside an option block, an option check validates that its operand expression is not null. If it is, the entire option block is aborted and evaluates to null. This simplifies consecutive null handling by avoiding verbose switch expressions.
For example, the expression
do? { f(x!, y!) + z!.a }evaluates to null if eitherx,y, orzis null; otherwise, it takes the options' contents and ultimately returns?r, whereris the result of the addition.The argument to a
doordo ?expression must be a block { ... }, never a simple expression.