V0.6.18 of the SDK is now available!
Features and fixes include the following updates:
- A fix to
dfx upgrade
that prevents a main thread panic whenOption::unwrap()
is called on aNone
value. - 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 tonull
if eitherx
,y
orz
isnull
; otherwise, it takes the options’ contents and ultimately returns?r
, wherer
is the result of the addition. - The argument to a
do
ordo ?
expression must be a block{ ... }
, never a simple expression.
Full release notes and more can be found here