0.9.4
-
motoko (
moc)-
Allow multiline text literals (#3995).
For example,"A horse walks into a bar. The barman says: `Why the long face?`"parses as:
"A horse walks into a bar.\nThe barman says: `Why the long face?`" -
Added pipe operator
<exp1> |> <exp2>and placeholder expression_(#3987).
For example:Iter.range(0, 10) |> Iter.toList _ |> List.filter<Nat>(_, func n { n % 3 == 0 }) |> { multiples = _ };
may, according to taste, be a more readable rendition of:
{ multiples = List.filter<Nat>( Iter.toList(Iter.range(0, 10)), func n { n % 3 == 0 }) };However, beware the change of evaluation order for code with side-effects.
-
BREAKING CHANGE (Minor):
New keyword
compositeallows one to declare Internet Computer composite queries (#4003).For example,
public shared composite query func sum(counters : [Counter]) : async Nat { var sum = 0; for (counter in counters.vals()) { sum += await counter.peek(); }; sum }
has type:
shared composite query [Counter] -> async Nat
and can call both
queryand othercomposite queryfunctions.See the documentation for full details.
-
Allow canister imports of Candid service constructors, ignoring the service arguments to
import the instantiated service instead (with a warning) (#4041). -
Allow optional terminal semicolons in Candid imports (#4042).
-
bugfix: allow signed float literals as static expressions in modules (#4063).
-
bugfix: improved reporting of patterns with record types in error messages (#4002).
-
-
motoko-base
- Added more
Array(andText) utility functions (thanks to roman-kashitsyn) (caffeinelabs/motoko-base#564).
- Added more