V0.6.18 of the SDK is now available!
Features and fixes include the following updates:
- A fix to
dfx upgradethat prevents a main thread panic whenOption::unwrap()is called on aNonevalue. - A fix to the name of the language service command to restore its compatibility with IDEs.
For 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 notnull. If it is, the entire option block is aborted and evaluates tonull. This simplifies consecutive null handling by avoiding verbose switch expressions.
For example, the expressiondo? { f(x!, y!) + z!.a }evaluates tonullif eitherx,yorzisnull; 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.
Full release notes and more can be found here