ic-mops 0.26.2 → 0.26.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1435 @@
1
+ // const markdownHeadings = require('markdown-headings');
2
+ // import markdownHeadings from 'markdown-headings';
3
+ import { fromMarkdown } from 'mdast-util-from-markdown';
4
+ import { toMarkdown } from 'mdast-util-to-markdown';
5
+ let str = `
6
+ # Motoko compiler changelog
7
+
8
+ ## 0.9.8 (2023-08-11)
9
+
10
+ * motoko (\`moc\`)
11
+
12
+ * Added numerical type conversions between adjacent fixed-width types (#4139).
13
+
14
+ * Administrative: legacy-named release artefacts are no longer created (#4111).
15
+
16
+ ## 0.9.7 (2023-07-18)
17
+
18
+ * motoko (\`moc\`)
19
+
20
+ * Performance improvement: lower the default allocation for bignums (#4102).
21
+
22
+ * Performance improvement: generate better code for pattern matches on some small variants (#4093).
23
+
24
+ * bugfix: don't crash on import of Candid composite queries (#4128).
25
+
26
+ ## 0.9.6 (2023-07-07)
27
+
28
+ * motoko (\`moc\`)
29
+
30
+ * Allow canister controllers to call the \`__motoko_stable_var_info\` query endpoint (#4103).
31
+ (Previously only self-queries were permitted.)
32
+
33
+ * Performance improvement: reduced cycle consumption for allocating objects (#4095).
34
+
35
+ * bugfix: reduced memory consumption in the Motoko Playground (#4106).
36
+
37
+ ## 0.9.5 (2023-07-05)
38
+
39
+ * motoko (\`moc\`)
40
+
41
+ * Allow identifiers in \`or\`-patterns (#3807).
42
+ Bindings in alternatives must mention the same identifiers and have compatible types:
43
+ \`\`\` Motoko
44
+ let verbose = switch result {
45
+ case (#ok) "All is good!";
46
+ case (#warning why or #error why) "There is some problem: " # why;
47
+ }
48
+ \`\`\`
49
+
50
+ * Performance improvement: improved cycle consumption allocating fixed-size objects (#4064).
51
+ Benchmarks indicate up to 10% less cycles burned for allocation-heavy code,
52
+ and 2.5% savings in realistic applications.
53
+
54
+ * Administrative: binary build artefacts are now available according to standard naming
55
+ conventions (thanks to EnzoPlayer0ne) (#3997).
56
+ Please consider transitioning to downloading binaries following the new scheme,
57
+ as legacy naming will be discontinued at some point in the future.
58
+
59
+ ## 0.9.4 (2023-07-01)
60
+
61
+ * motoko (\`moc\`)
62
+
63
+ * Allow multiline text literals (#3995).
64
+ For example,
65
+ \`\`\`
66
+ "A horse walks into a bar.
67
+ The barman says: \`Why the long face?\`"
68
+ \`\`\`
69
+
70
+ parses as:
71
+ \`\`\`
72
+ "A horse walks into a bar.\nThe barman says: \`Why the long face?\`"
73
+ \`\`\`
74
+
75
+ * Added pipe operator \`<exp1> |> <exp2>\` and placeholder expression \`_\` (#3987).
76
+ For example:
77
+ \`\`\` motoko
78
+ Iter.range(0, 10) |>
79
+ Iter.toList _ |>
80
+ List.filter<Nat>(_, func n { n % 3 == 0 }) |>
81
+ { multiples = _ };
82
+ \`\`\`
83
+
84
+ may, according to taste, be a more readable rendition of:
85
+ \`\`\` motoko
86
+ { multiples =
87
+ List.filter<Nat>(
88
+ Iter.toList(Iter.range(0, 10)),
89
+ func n { n % 3 == 0 }) };
90
+ \`\`\`
91
+
92
+ However, beware the change of evaluation order for code with side-effects.
93
+
94
+ * BREAKING CHANGE (Minor):
95
+
96
+ New keyword \`composite\` allows one to declare Internet Computer *composite queries* (#4003).
97
+
98
+ For example,
99
+ \`\`\` motoko
100
+ public shared composite query func sum(counters : [Counter]) : async Nat {
101
+ var sum = 0;
102
+ for (counter in counters.vals()) {
103
+ sum += await counter.peek();
104
+ };
105
+ sum
106
+ }
107
+ \`\`\`
108
+
109
+ has type:
110
+ \`\`\` motoko
111
+ shared composite query [Counter] -> async Nat
112
+ \`\`\`
113
+
114
+ and can call both \`query\` and other \`composite query\` functions.
115
+
116
+ See the documentation for full details.
117
+
118
+ * Allow canister imports of Candid service constructors, ignoring the service arguments to
119
+ import the instantiated service instead (with a warning) (#4041).
120
+
121
+ * Allow optional terminal semicolons in Candid imports (#4042).
122
+
123
+ * bugfix: allow signed float literals as static expressions in modules (#4063).
124
+
125
+ * bugfix: improved reporting of patterns with record types in error messages (#4002).
126
+
127
+ * motoko-base
128
+
129
+ * Added more \`Array\` (and \`Text\`) utility functions (thanks to roman-kashitsyn) (dfinity/motoko-base⁠#564).
130
+
131
+ ## 0.9.3 (2023-06-19)
132
+
133
+ * motoko (\`moc\`)
134
+
135
+ * Added fields \`sender_canister_version\` for actor class version tracking (#4036).
136
+
137
+ ## 0.9.2 (2023-06-10)
138
+
139
+ * motoko (\`moc\`)
140
+
141
+ * BREAKING CHANGE (Minor):
142
+
143
+ \`or\`-patterns in function definitions cannot be inferred any more. The new error
144
+ message suggests to add a type annotation instead. This became necessary in order
145
+ to avoid potentially unsound types (#4012).
146
+
147
+ * Added implementation for \`ic0.canister_version\` as a primitive (#4027).
148
+
149
+ * Added a more efficient \`Prim.blobCompare\` (thanks to nomeata) (#4009).
150
+
151
+ * bugfix: minor error in grammar for \`async*\` expressions (#4005).
152
+
153
+ * motoko-base
154
+
155
+ * Add \`Principal.isController\` function (dfinity/motoko-base#558).
156
+
157
+ ## 0.9.1 (2023-05-15)
158
+
159
+ * motoko (\`moc\`)
160
+
161
+ * Added implementation for \`ic0.is_controller\` as a primitive (#3935).
162
+
163
+ * Added ability to enable the new incremental GC in the Motoko Playground (#3976).
164
+
165
+ ## 0.9.0 (2023-05-12)
166
+
167
+ * motoko (\`moc\`)
168
+
169
+ * **For beta testing:** Add a new _incremental_ GC, enabled with new moc flag \`--incremental-gc\` (#3837).
170
+ The incremental garbage collector is designed to scale for large program heap sizes.
171
+
172
+ The GC distributes its workload across multiple steps, called increments, that each pause the mutator
173
+ (user's program) for only a limited amount of time. As a result, the GC work can fit within the instruction-limited
174
+ IC messages, regardless of the heap size and the object structures.
175
+
176
+ According to GC benchmark measurements, the incremental GC is more efficient than the existing copying, compacting,
177
+ and generational GC in the following regards:
178
+ * Scalability: Able to use the full heap space, 3x more object allocations on average.
179
+ * Shorter interruptions: The GC pause has a maximum limit that is up to 10x shorter.
180
+ * Lower runtimes: The number of executed instructions is reduced by 10% on average (compared to the copying GC).
181
+ * Less GC overhead: The amount of GC work in proportion to the user's program work drops by 10-16%.
182
+
183
+ The GC incurs a moderate memory overhead: The allocated WASM memory has been measured to be 9% higher
184
+ on average compared to the copying GC, which is the current default GC.
185
+
186
+ To activate the incremental GC under \`dfx\`, the following command-line argument needs to be specified in \`dfx.json\`:
187
+
188
+ \`\`\`
189
+ ...
190
+ "type" : "motoko"
191
+ ...
192
+ "args" : "--incremental-gc"
193
+ ...
194
+ \`\`\`
195
+
196
+ * bugfix: \`array.vals()\` now returns a working iterator for mutable arrays (#3497, #3967).
197
+
198
+ ## 0.8.8 (2023-05-02)
199
+
200
+ * motoko (\`moc\`)
201
+
202
+ * Performance improvement: optimised code generation for pattern matching that cannot fail (#3957).
203
+
204
+ ## 0.8.7 (2023-04-06)
205
+
206
+ * motoko (\`moc\`)
207
+
208
+ * Added ability to \`mo-doc\` for rendering documentation of nested modules (#3918).
209
+
210
+ * bugfix: when re-adding recurrent timers, skip over past expirations (#3871).
211
+
212
+ * bugfix: eliminated crash compiling local \`async\` functions that pattern match on arguments (#3910, #3916).
213
+
214
+ ## 0.8.6 (2023-04-01)
215
+
216
+ * motoko (\`moc\`)
217
+
218
+ * bugfix: avoid compiler crash (regression) when \`let\`-matching on constant variants (#3901, #3903).
219
+
220
+ * Performance improvement: improved cycle usage when receiving messages (#3893).
221
+
222
+ ## 0.8.5 (2023-03-20)
223
+
224
+ * motoko (\`moc\`)
225
+
226
+ * Performance improvement: Values of variant type that are compile-time known
227
+ are relegated to the static heap now and don't get allocated each time (#3878).
228
+
229
+ * bugfix: the global timer expiration callback was called unnecessarily in the
230
+ default mechanism (#3883).
231
+
232
+ ## 0.8.4 (2023-03-11)
233
+
234
+ * motoko (\`moc\`)
235
+
236
+ * Performance improvement: UTF-8 coding and validation is now properly tail recursive (#3842).
237
+
238
+ * Performance improvement: eliminated bounds checking for certain array accesses (thanks to nomeata) (#3853).
239
+
240
+ * Performance improvement: optimized \`{array, blob, text}.size()\` operations (thanks to nomeata) (#3863).
241
+
242
+ * Performance improvement: efficient tuple results in \`switch\` statements (thanks to nomeata) (#3865).
243
+
244
+ * Performance improvement: more efficient untagging operation (#3873).
245
+
246
+ * bugfix: restored a grammar regression caused by \`let-else\` (#3869).
247
+
248
+ * motoko-base
249
+
250
+ * Add \`Array.subArray\` function (dfinity/motoko-base#445).
251
+
252
+ * BREAKING CHANGE (Minor)
253
+
254
+ Optimized \`AssocList.{replace, find}\` to avoid unnecessary allocation (dfinity/motoko-base#535, dfinity/motoko-base#539).
255
+ Note: this subtly changes the order in which the key-value pairs occur after replacement. May affect other containers that use \`AssocList\`.
256
+
257
+ * Performance improvement: Optimized deletion for \`Trie\`/\`TrieMap\` (dfinity/motoko-base#525).
258
+
259
+ ## 0.8.3 (2023-02-24)
260
+
261
+ * motoko (\`moc\`)
262
+
263
+ * new 'let-else' construct for handling pattern-match failure (#3836).
264
+ This is a frequently asked-for feature that allows to change the control-flow
265
+ of programs when pattern-match failure occurs, thus providing a means against
266
+ the famous "pyramid of doom" issue. A common example is look-ups:
267
+ \`\`\` Motoko
268
+ shared func getUser(user : Text) : async Id {
269
+ let ?id = Map.get(users, user) else { throw Error.reject("no such user") };
270
+ id
271
+ }
272
+ \`\`\`
273
+ Similarly, an expression like
274
+ \`\`\` Motoko
275
+ (label v : Bool { let <pat> = <exp> else break v false; true })
276
+ \`\`\`
277
+ evaluates to a \`Bool\`, signifying whether \`<pat>\` matches \`<exp>\`.
278
+
279
+ * Improve recursive deserialization capacity to match recursive serialization capacity by reducing
280
+ Wasm stack consumption (#3809).
281
+ Because of the bounds on recursion depth imposed by fixed-size stack, the
282
+ advice remains the same: avoid deeply nested recursive data structures.
283
+ Think "shallow trees good, very long lists bad".
284
+
285
+ * bugfix: stack overflow in UTF-8 encode/decode for \`moc.js\` (#3825).
286
+
287
+ * motoko-base
288
+
289
+ * add missing \`unshare : Tree<K, V> -> ()\` method to class \`RBTree<K, V>\`
290
+ to restore objects from saved state (dfinity/motoko-base#532).
291
+
292
+ ## 0.8.2 (2023-02-17)
293
+
294
+ * motoko (\`moc\`)
295
+
296
+ * Add compiler flag \`--rts-stack-pages <n>\` to override default number of
297
+ pages dedicated to fixed runtime system stack. Now defaults to 32 pages
298
+ (2MiB) (up from previous 2 pages/128KiB) (#3782).
299
+ In emergencies, increasing this setting may improve your ability to deserialize
300
+ deeply nested Candid or stable variable data.
301
+
302
+ * Add stack overflow detection utilising reserved page (#3793).
303
+
304
+ * Performance improvement: heap allocator speedup (#3090, #3790).
305
+
306
+ * bugfix: avoid more heap-out-bounds errors during deserialization of stable variables
307
+ by increasing default runtime system stack from 128KiB to 2MiB (#3782).
308
+ _Note_: this is a partial fix, as issues with stack growth remain.
309
+
310
+ * motoko-base
311
+
312
+ * bugfix: non-leaky deletion for \`RBTree\` (dfinity/motoko-base#524).
313
+
314
+ ## 0.8.1 (2023-02-03)
315
+
316
+ * motoko (\`moc\`)
317
+
318
+ * Performance improvement: faster heap allocation (#3765).
319
+
320
+ * bugfix: \`async\` returns involving abbreviated tuple types no longer crash the compiler (#3740, #3741).
321
+
322
+ * bugfix: avoid quadratic code expansion due to imported, but unused, actor classes (#3758).
323
+
324
+ ## 0.8.0 (2023-01-27)
325
+
326
+ * motoko (\`moc\`)
327
+
328
+ * BREAKING CHANGE
329
+
330
+ Motoko now implements Candid 1.4 (dfinity/candid#311).
331
+
332
+ In particular, when deserializing an actor or function reference,
333
+ Motoko will now first check that the type of the deserialized reference
334
+ is a subtype of the expected type and act accordingly.
335
+
336
+ Very few users should be affected by this change in behaviour.
337
+
338
+ * BREAKING CHANGE
339
+
340
+ Failure to send a message no longer traps but, instead, throws a catchable \`Error\` with new error code \`#call_error\` (#3630).
341
+
342
+ On the IC, the act of making a call to a canister function can fail, so that the call cannot (and will not be) performed.
343
+ This can happen due to a lack of canister resources, typically because the local message queue for the destination canister is full,
344
+ or because performing the call would reduce the current cycle balance of the calling canister to a level below its freezing threshold.
345
+ Such call failures are now reported by throwing an \`Error\` with new \`ErrorCode\` \`#call_error { err_code = n }\`,
346
+ where \`n\` is the non-zero \`err_code\` value returned by the IC.
347
+ Like other errors, call errors can be caught and handled using \`try ... catch ...\` expressions, if desired.
348
+
349
+ The constructs that now throw call errors, instead of trapping as with previous version of Motoko are:
350
+ * calls to \`shared\` functions (including oneway functions that return \`()\`).
351
+ These involve sending a message to another canister, and can fail when the queue for the destination canister is full.
352
+ * calls to local functions with return type \`async\`. These involve sending a message to self, and can fail when the local queue for sends to self is full.
353
+ * \`async\` expressions. These involve sending a message to self, and can fail when the local queue for sends to self is full.
354
+ * \`await\` expressions. These can fail on awaiting an already completed future, which requires sending a message to self to suspend and commit state.
355
+
356
+ (On the other hand, \`async*\` (being delayed) cannot throw, and evaluating \`await*\` will at most propagate an error from its argument but not, in itself, throw.)
357
+
358
+ Note that exiting a function call via an uncaught throw, rather than a trap, will commit any state changes and currently queued messages.
359
+ The previous behaviour of trapping would, instead, discard, such changes.
360
+
361
+ To appreciate the change in semantics, consider the following example:
362
+
363
+ \`\`\` motoko
364
+ actor {
365
+ var count = 0;
366
+ public func inc() : async () {
367
+ count += 1;
368
+ };
369
+ public func repeat() : async () {
370
+ loop {
371
+ ignore inc();
372
+ }
373
+ };
374
+ public func repeatUntil() : async () {
375
+ try {
376
+ loop {
377
+ ignore inc();
378
+ }
379
+ } catch (e) {
380
+ }
381
+ };
382
+ }
383
+ \`\`\`
384
+
385
+ In previous releases of Motoko, calling \`repeat()\` and \`repeatUntil()\` would trap, leaving \`count\` at \`0\`, because
386
+ each infinite loop would eventually exhaust the message queue and issue a trap, rolling back the effects of each call.
387
+ With this release of Motoko, calling \`repeat()\` will enqueue several \`inc()\` messages (around 500), then \`throw\` an \`Error\`
388
+ and exit with the error result, incrementing the \`count\` several times (asynchronously).
389
+ Calling \`repeatUntil()\` will also enqueue several \`inc()\` messages (around 500) but the error is caught so the call returns,
390
+ still incrementing \`count\` several times (asynchronously).
391
+
392
+ The previous semantics of trapping on call errors can be enabled with compiler option \`--trap-on-call-error\`, if desired,
393
+ or selectively emulated by forcing a trap (e.g. \`assert false\`) when an error is caught.
394
+
395
+ For example,
396
+
397
+ \`\`\` motoko
398
+ public func allOrNothing() : async () {
399
+ try {
400
+ loop {
401
+ ignore inc();
402
+ }
403
+ } catch (e) {
404
+ assert false; // trap!
405
+ }
406
+ };
407
+ \`\`\`
408
+
409
+ Calling \`allOrNothing()\` will not send any messages: the loop exits with an error on queue full,
410
+ the error is caught, but \`assert false\` traps so all queued \`inc()\` messages are aborted.
411
+
412
+ * bugfix: system method \`inspect\` involving message with single tuple argument no longer crashes the compiler (#3732, #3733).
413
+
414
+ ## 0.7.6 (2023-01-20)
415
+
416
+ * motoko (\`moc\`)
417
+
418
+ * Added support for \`ManagementCanister.raw_rand\` in interpreters (#3693).
419
+
420
+ * Added preliminary Viper support for \`old\` expressions in specifications and calls to private methods (#3675).
421
+
422
+ * bugfix: in the default timer mechanism \`cancelTimer\` sometimes wouldn't actually stop a recurring timer (#3695).
423
+
424
+ * bugfix: zero negation for floating point numbers in compiled code (#3676).
425
+
426
+ * motoko-base
427
+
428
+ * Add user-facing timer functionality (dfinity/motoko-base#474).
429
+
430
+ * Add \`Array.size\` (dfinity/motoko-base#486, dfinity/motoko-base#494).
431
+
432
+ * Add \`TrieSet\` methods \`isEmpty\`, \`isSubset\` (dfinity/motoko-base#503).
433
+
434
+ * BREAKING CHANGES (Minor):
435
+ - renamed \`Float.neq\` to \`Float.neg\` (this was a misspelling)
436
+ - renamed \`Nat.neq\` to \`Nat.neg\` (this was a misspelling)
437
+ - removed second argument from \`bitnot\` (this was an oversight)
438
+
439
+ * bugfix: \`Random.Finite.coin\` didn't use entropy correctly (dfinity/motoko-base#500).
440
+
441
+ * bugfix: \`Trie.mergeDisjoint\` (dfinity/motoko-base#505).
442
+
443
+ * bugfix: \`TrieSet.equals\` (dfinity/motoko-base#503).
444
+
445
+ * Various documentation fixes and API usage examples.
446
+
447
+ ## 0.7.5 (2022-12-23)
448
+
449
+ * motoko (\`moc\`)
450
+
451
+ * Add new primitives for a default timer mechanism (#3542). These are
452
+ \`\`\` Motoko
453
+ setTimer : (delayNanos : Nat64, recurring : Bool, job : () -> async ()) -> (id : Nat)
454
+ cancelTimer : (id : Nat) -> ()
455
+ \`\`\`
456
+ By defining a \`system func timer\` the default mechanism can now be overridden by a custom
457
+ implementation. Additionally by supplying the command-line flag \`-no-timer\` all aspects
458
+ of timers can be suppressed, e.g. for space- or security-sensitive purposes, thus effectively
459
+ reverting canisters to the pre-timers era.
460
+
461
+ * bugfix: silence bogus cascading errors in stable compatibility check (#3645).
462
+
463
+ ## 0.7.4 (2022-12-07)
464
+
465
+ * motoko (\`moc\`)
466
+
467
+ * Add new keywords \`async*\` and \`await*\` (note the \`*\`) for efficient abstraction of asynchronous code (#3609).
468
+ \`\`\`
469
+ <typ> ::= ...
470
+ async* <typ> delayed, asynchronous computation
471
+ <exp> ::= ...
472
+ async* <block-or-exp> delay an asynchronous computation
473
+ await* <block-or-exp> execute a delayed computation (only in async, async*)
474
+ \`\`\`
475
+ This avoids the resource consumption and latency of \`async\`/\`await\` by only committing state and suspending execution
476
+ when necessary in the \`await*\`-ed computation, not necessarily at the \`await*\` itself.
477
+
478
+ WARNING: Unlike \`async\`/\`await\`:
479
+ * an \`async*\` value has no effect unless \`await*\`-ed;
480
+ * each \`await*\` of the same \`async*\` value repeats its effects.
481
+
482
+ This feature is experimental and may evolve in future. Use with discretion.
483
+ See the [manual](doc/md/language-manual.md) for details.
484
+
485
+ * Suppress GC during IC \`canister_heartbeat\`, deferring any GC to the scheduled Motoko \`heartbeat\` \`system\` method (#3623).
486
+ This is a temporary workaround, to be removed once DTS is supported for \`canister_heartbeat\` itself (#3622).
487
+
488
+ * Add a new _generational_ GC, enabled with new moc flag \`--generational-gc\` (#3495).
489
+ The generational garbage collector optimizes for fast reclamation of short-lived objects.
490
+ New objects are allocated in a young generation that is more frequently collected than the older objects
491
+ that have already survived a GC run.
492
+
493
+ For many cases, the generational GC is more efficient than the existing compacting GC and copying GCs:
494
+ * Lower runtimes: Less number of executed instructions on average.
495
+ * Shorter interruptions: Young generation collection entails shorter program interruptions.
496
+
497
+ To activate the generational GC under \`dfx\`, the following command-line argument needs to be specified in \`dfx.json\`:
498
+
499
+ \`\`\`
500
+ ...
501
+ "type" : "motoko"
502
+ ...
503
+ "args" : "--generational-gc"
504
+ ...
505
+ \`\`\`
506
+
507
+ * \`moc.js\` : add trampoline and step limiter to interpreter, avoiding (some) stackoverflows and
508
+ hangs (#3618, #3541).
509
+ Enables execution of larger examples on web pages.
510
+
511
+ * BREAKING CHANGE (Minor):
512
+
513
+ Consider records with mutable fields as non-static (#3586).
514
+ Consequently, an imported library declaring a mutable record is now
515
+ rejected, not accepted, to be consistent with the declarations of
516
+ mutable fields and mutable objects.
517
+
518
+ * Experimental Viper integration by compiling a very narrow subset of
519
+ Motoko to the verification intermediate language. See \`src/viper/README.md\`
520
+ and the PR for details. (#3477).
521
+
522
+ * motoko-base
523
+
524
+ * Unit tests for Trie and fix for \`disj\` (dfinity/motoko-base#438).
525
+
526
+ * Respect Trie structure in \`filter\` (dfinity/motoko-base#431, dfinity/motoko-base#438).
527
+
528
+ * Array module reimplementation, tests and documentation (dfinity/motoko-base#425,dfinity/motoko-base#432).
529
+
530
+ ## 0.7.3 (2022-11-01)
531
+
532
+ * motoko (\`moc\`)
533
+
534
+ * Statically reject shared functions and function types with type parameters (#3519, #3522).
535
+
536
+ * Performance improvement: \`Array.init\` and \`Array.tabulate\` (#3526).
537
+
538
+ * motoko-base
539
+
540
+ * Add some examples to \`Buffer\` library documentation (dfinity/motoko-base#420).
541
+
542
+ * Fix another bug in \`Buffer\` library affecting \`filterEntries\` (dfinity/motoko-base#422).
543
+
544
+ ## 0.7.2 (2022-10-25)
545
+
546
+ * motoko-base
547
+
548
+ * Fix bugs in \`Buffer\` library affecting \`remove\` and \`filterEntries\` (dfinity/motoko-base#419).
549
+
550
+ ## 0.7.1 (2022-10-24)
551
+
552
+ * motoko (\`moc\`)
553
+
554
+ * Halve (default ir-checking) compilation times by optimizing type comparison and hashing (#3463)
555
+
556
+ * Add support for type components in object type syntax (#3457, also fixes #3449)
557
+ \`\`\` motoko
558
+ type Record = { type T = Nat; x : Nat};
559
+ \`\`\`
560
+ is now legal.
561
+ Note the definition of \`T\` is neither recursive, nor bound in \`x : Nat\`,
562
+ but can refer to an existing recursive type declared in an outer scope.
563
+
564
+ * motoko-base
565
+
566
+ * Optimized and extended \`Buffer\` library (dfinity/motoko-base#417).
567
+
568
+ ## 0.7.0 (2022-08-25)
569
+
570
+ * motoko (\`moc\`)
571
+
572
+ * BREAKING CHANGE (Minor):
573
+ Adds new syntax for merging records (objects) and
574
+ adding/overwriting fields. The expression
575
+ \`\`\` motoko
576
+ { baseA and baseB with field1 = val1; field2 = val2 }
577
+ \`\`\`
578
+ creates a new record by joining all (statically known) fields from
579
+ \`baseA/B\` and the explicitly specified \`field1/2\`.
580
+ This is a _breaking change_, as a new keyword \`with\` has been added.
581
+ Restrictions for ambiguous and \`var\` fields from bases apply. (#3084)
582
+
583
+ * Add new support for installing actor class instances on the IC,
584
+ enabling specification of canister settings, install, upgrade and
585
+ reinstall. (#3386)
586
+
587
+ A new expression
588
+
589
+ \`\`\` bnf
590
+ (system <exp> . <id>)
591
+ \`\`\`
592
+ where \`<exp>\` is an imported library and \`<id>\` is the name of
593
+ an actor class, accesses a secondary constructor of the class
594
+ that takes an additional argument controlling the installation.
595
+
596
+ For example,
597
+ \`\`\` motoko
598
+ await (system Lib.Node)(#upgrade a)(i);
599
+ \`\`\`
600
+ upgrades actor \`a\` with the code for a new instance of class \`Lib.Node\`,
601
+ passing constructor argument \`(i)\`.
602
+
603
+ * Performance improvements for assigment-heavy code (thanks to nomeata) (#3406)
604
+
605
+ ## 0.6.30 (2022-08-11)
606
+
607
+ * motoko (\`moc\`)
608
+
609
+ * add primitives
610
+ \`\`\`motoko
611
+ shiftLeft : (Nat, Nat32) -> Nat
612
+ shiftRight : (Nat, Nat32) -> Nat
613
+ \`\`\`
614
+ for efficiently multiplying/dividing a \`Nat\` by a power of 2
615
+ (#3112)
616
+
617
+ * add primitives
618
+ \`\`\`motoko
619
+ rts_mutator_instructions : () -> Nat
620
+ rts_collector_instructions : () -> Nat
621
+ \`\`\`
622
+ to report approximate IC instruction costs of the last message
623
+ due to mutation (computation) and collection (GC), respectively (#3381)
624
+
625
+ * motoko-base
626
+
627
+ * Add
628
+ \`\`\`motoko
629
+ Buffer.fromArray
630
+ Buffer.fromVarArray
631
+ \`\`\`
632
+ for efficiently adding an array to a \`Buffer\`
633
+ (dfinity/motoko-base#389)
634
+
635
+ * Add
636
+ \`\`\`motoko
637
+ Iter.sort : (xs : Iter<A>, compare : (A, A) -> Order) : Iter<A>
638
+ \`\`\`
639
+ for sorting an \`Iter\` given a comparison function
640
+ (dfinity/motoko-base#406)
641
+
642
+ * Performance: \`HashMap\` now avoids re-computing hashes on \`resize\`
643
+ (dfinity/motoko-base#394)
644
+
645
+ ## 0.6.29 (2022-06-10)
646
+
647
+ * motoko (\`moc\`)
648
+
649
+ * The language server now supports explicit symbol imports (thanks
650
+ to rvanasa) (#3282)
651
+ * The language server now has improved support for navigating to
652
+ definitions in external modules (thanks to rvanasa) (#3263)
653
+ * Added a primitive \`textCompare\` allowing more efficient three-way
654
+ \`Text\` comparisons (#3298)
655
+ * Fixed a typing bug with annotated, recursive records (#3268)
656
+
657
+ * motoko-base
658
+
659
+ * Add
660
+ \`\`\`motoko
661
+ ExperimentalInternetComputer.countInstruction : (comp : () -> ()) -> Nat64
662
+ \`\`\`
663
+ to count the Wasm instructions performed during execution of \`comp()\` (dfinity/motoko-base#381)
664
+
665
+ * Add
666
+ \`\`\`motoko
667
+ ExperimentalStableMemory.stableVarQuery : () -> (shared query () -> async {size : Nat64})
668
+ \`\`\`
669
+ for estimating stable variable storage requirements during upgrade
670
+ (dfinity/motoko-base#365)
671
+ * Performance improvement to \`Text.compare\` (dfinity/motoko-base#382)
672
+
673
+ ## 0.6.28 (2022-05-19)
674
+
675
+ * motoko (\`moc\`)
676
+
677
+ * Add \`to_candid\`, \`from_candid\` language constructs for Candid serialization to/from Blobs (#3155)
678
+ * New \`system\` field 'inspect' for accepting/declining canister ingress messages (see doc) (#3210)
679
+
680
+ ## 0.6.27 (2022-05-04)
681
+
682
+ * motoko (\`moc\`)
683
+
684
+ * Importing modules by relative path is now more robust (#3215).
685
+ * Performance: persisting stable variables to stable memory is now
686
+ performed in streaming fashion, reducing heap consumption and
687
+ copying during an upgrade (#3149).
688
+ * Performance: local 32- and 64-bit numeric values are now stored in
689
+ using unboxed form when possible (thanks to nomeata) (#3207).
690
+
691
+ * motoko-base
692
+
693
+ * Fixed a bug in \`Trie.filter\` (and \`Trie.mapFilter\`) which could
694
+ lead to missing matches in some cases (dfinity/motoko-base#371).
695
+
696
+ ## 0.6.26 (2022-04-20)
697
+
698
+ * motoko (\`moc\`)
699
+
700
+ * Performance: inline prim-wrapping functions (thanks to nomeata) (#3159)
701
+ * Improve type pretty printer to mirror type parser (avoids producing unparseable stable variable signatures) (#3190)
702
+ * Adds new flag \`--omit-metadata\` to omit certain metadata sections from \`actor\` (and \`actor class\`) Wasm (#3164)
703
+ * Performance: avoid redundant heap allocation when deserializing compact Candid \`int\` and \`nat\` values (#3173)
704
+ * Added a primitive to obtain stable variable memory footprint (#3049)
705
+
706
+ * motoko-base
707
+
708
+ * Fixed the 32-bit range limitation of \`Hash.hash: Nat -> Nat32\` and
709
+ deprecate most functions in \`Hash\` (dfinity/motoko-base#366).
710
+ * Add \`List.toIter\` (thanks to hoosan) (dfinity/motoko-base#336).
711
+
712
+ ## 0.6.25 (2022-03-07)
713
+
714
+ * motoko (\`moc\`)
715
+
716
+ * bugfix: fix bogus elision of type constructors sharing names with primitive types in \`--stable-types\` section and \`.most\` file (#3140)
717
+
718
+ ## 0.6.24 (2022-03-06)
719
+
720
+ * motoko (\`moc\`)
721
+
722
+ * bugfix: fix bogus identification of distinct type constructors
723
+ in --stable-types section and .most file (#3140)
724
+
725
+ ## 0.6.23 (2022-03-05)
726
+
727
+ * motoko (\`moc\`)
728
+
729
+ * bugfix: fix pretty printing of (stable) types and #3128 (#3130)
730
+
731
+ * Collect constructors *transitively* before emitting a .most file.
732
+ * Modifies type pretty printer to produce well-formed types and stable type signatures.
733
+
734
+ ## 0.6.22 (2022-02-24)
735
+
736
+ * motoko (\`moc\`)
737
+
738
+ * Fix: remove bogus error when transitively importing module with
739
+ selective field imports (#3121)
740
+ * Fix: Treating eponymous types from separate candid files (#3103)
741
+
742
+ * Various reports from CI are now pushed to
743
+ https://dfinity.github.io/motoko (#3113)
744
+
745
+ ## 0.6.21 (2022-01-31)
746
+
747
+ * motoko (\`moc\`)
748
+
749
+ * Emit new ICP metadata custom section 'motoko:compiler' with compiler release or revision in UTF8 (e.g. "0.6.21"). Default is \`icp:private\` (#3091).
750
+ * Generalized \`import\` supporting pattern matching and selective field imports (#3076).
751
+ * Fix: insert critical overflow checks preventing rare heap corruptions
752
+ in out-of-memory allocation and stable variable serialization (#3077).
753
+ * Implement support for 128-bit Cycles-API (#3042).
754
+
755
+ * motoko-base
756
+
757
+ * \`ExperimentalInternetComputer\` library, exposing low-level, binary \`call\` function (a.k.a. "raw calls") (dfinity/motoko-base#334, Motoko #3806).
758
+ * \`Principal.fromBlob\` added (dfinity/motoko-base#331).
759
+
760
+ ## 0.6.20 (2022-01-11)
761
+
762
+ * motoko
763
+
764
+ * Implement support for \`heartbeat\` system methods (thanks to ninegua) (#2971)
765
+
766
+ * motoko-base
767
+
768
+ * Add \`Iter.filter : <A>(Iter<A>, A -> Bool) -> Iter<A>\` (thanks to jzxchiang1) (dfinity/motoko-base#328).
769
+
770
+ ## 0.6.19 (2022-01-05)
771
+
772
+ * motoko-base
773
+
774
+ * Fixed a bug in the \`RBTree.size()\` method.
775
+
776
+ ## 0.6.18 (2021-12-20)
777
+
778
+ * moc
779
+
780
+ * Add runtime support for low-level, direct access to 64-bit IC stable memory, including documentation.
781
+ * Add compiler flag \`--max-stable-pages <n>\` to cap any use of \`ExperimentalStableMemory.mo\` (see below), while reserving space for stable variables.
782
+ Defaults to 65536 (4GiB).
783
+
784
+ * motoko-base
785
+
786
+ * (Officially) add \`ExperimentalStableMemory.mo\` library, exposing 64-bit IC stable memory
787
+
788
+ * BREAKING CHANGE (Minor):
789
+ The previously available (but unadvertised) \`ExperimentalStableMemory.mo\` used
790
+ \`Nat32\` offsets. This one uses \`Nat64\` offsets to (eventually) provide access to more address space.
791
+
792
+ ## 0.6.17 (2021-12-10)
793
+
794
+ * Improved handling of one-shot messages facilitating zero-downtime
795
+ upgrades (#2938).
796
+ * Further performance improvements to the mark-compact garbage
797
+ collector (#2952, #2973).
798
+ * Stable variable checking for \`moc.js\` (#2969).
799
+ * A bug was fixed in the scoping checker (#2977).
800
+
801
+ ## 0.6.16 (2021-12-03)
802
+
803
+ * Minor performance improvement to the mark-compact garbage collector
804
+
805
+
806
+ ## 0.6.15 (2021-11-26)
807
+
808
+ * Fixes crash when (ill-typed) \`switch\` expression on non-variant
809
+ value has variant alternatives (#2934)
810
+
811
+ ## 0.6.14 (2021-11-19)
812
+
813
+ * The compiler now embeds the existing Candid interface and new
814
+ _stable signature_ of a canister in additional Wasm custom sections,
815
+ to be selectively exposed by the IC, and to be used by tools such as \`dfx\`
816
+ to verify upgrade compatibility (see extended documentation).
817
+
818
+ New compiler options:
819
+
820
+ * \`--public-metadata <name>\`: emit ICP custom section \`<name>\` (\`candid:args\` or \`candid:service\` or \`motoko:stable-types\`) as \`public\` (default is \`private\`)
821
+ * \`--stable-types\`: emit signature of stable types to \`.most\` file
822
+ * \`--stable-compatible <pre> <post>\`: test upgrade compatibility between stable-type signatures \`<pre>\` and \`<post>\`
823
+
824
+ A Motoko canister upgrade is safe provided:
825
+
826
+ * the canister's Candid interface evolves to a Candid subtype; and
827
+ * the canister's Motoko stable signature evolves to a _stable-compatible_ one.
828
+
829
+ (Candid subtyping can be verified using tool \`didc\` available at:
830
+ https://github.com/dfinity/candid.)
831
+
832
+ * BREAKING CHANGE (Minor):
833
+ Tightened typing for type-annotated patterns (including function parameters)
834
+ to prevent some cases of unintended and counter-intuitive type propagation.
835
+
836
+ This may break some rare programs that were accidentally relying on that
837
+ propagation. For example, the indexing \`xs[i]\` in the following snippet
838
+ happend to type-check before, because \`i\` was given the more precise
839
+ type \`Nat\` (inferred from \`run\`'s parameter type), regardless of the
840
+ overly liberal declaration as an \`Int\`:
841
+
842
+ \`\`\`motoko
843
+ func run(f : Nat -> Text) {...};
844
+ let xs = ["a", "b", "c"];
845
+ run(func(i : Int) { xs[i] });
846
+ \`\`\`
847
+ This no longer works, \`i\` has to be declared as \`Nat\` (or the type omitted).
848
+
849
+ If you encounter such cases, please adjust the type annotation.
850
+
851
+ * Improved garbage collection scheduling
852
+
853
+ * Miscellaneous performance improvements
854
+ - code generation for \`for\`-loops over arrays has improved
855
+ - slightly sped up \`Int\` equality comparisons
856
+
857
+ ## 0.6.13 (2021-11-19)
858
+
859
+ *Pulled*
860
+
861
+ ## 0.6.12 (2021-10-22)
862
+
863
+ * \`for\` loops over arrays are now converted to more efficient
864
+ index-based iteration (#2831). This can result in significant cycle
865
+ savings for tight loops, as well as slightly less memory usage.
866
+
867
+ * Add type union and intersection. The type expression
868
+
869
+ \`\`\`motoko
870
+ T and U
871
+ \`\`\`
872
+ produces the greatest lower bound of types \`T\` and \`U\`, that is,
873
+ the greatest type that is a subtype of both. Dually,
874
+
875
+ \`\`\`motoko
876
+ T or U
877
+ \`\`\`
878
+ produces the least upper bound of types \`T\` and \`U\`, that is,
879
+ the smallest type that is a supertype of both.
880
+
881
+ One use case of the former is "extending" an existing object type:
882
+
883
+ \`\`\` motoko
884
+ type Person = {name : Text; address : Text};
885
+ type Manager = Person and {underlings : [Person]};
886
+ \`\`\`
887
+ Similarly, the latter can be used to "extend" a variant type:
888
+ \`\`\`motoko
889
+ type Workday = {#mon; #tue; #wed; #thu; #fri};
890
+ type Weekday = Workday or {#sat; #sun};
891
+ \`\`\`
892
+
893
+ ## 0.6.11 (2021-10-08)
894
+
895
+ * Assertion error messages are now reproducible (#2821)
896
+
897
+ ## 0.6.10 (2021-09-23)
898
+
899
+ * moc
900
+
901
+ * documentation changes
902
+
903
+ * motoko-base
904
+
905
+ * documentation changes
906
+
907
+ ## 0.6.9 (2021-09-15)
908
+
909
+ * motoko-base
910
+
911
+ * add Debug.trap : Text -> None (dfinity/motoko-base#288)
912
+
913
+ ## 0.6.8 (2021-09-06)
914
+
915
+ * Introduce primitives for \`Int\` ⇔ \`Float\` conversions (#2733)
916
+ * Bump LLVM toolchain to version 12 (#2542)
917
+ * Support extended name linker sections (#2760)
918
+ * Fix crashing bug for formatting huge floats (#2737)
919
+
920
+ ## 0.6.7 (2021-08-16)
921
+
922
+ * moc
923
+
924
+ * Optimize field access by exploiting field ordering (#2708)
925
+ * Fix handling of self references in mark-compact GC (#2721)
926
+ * Restore CI reporting of perf-regressions (#2643)
927
+
928
+ * motoko-base:
929
+
930
+ * Fix bug in \`AssocList.diff\` (dfinity/motoko-base#277)
931
+ * Deprecate unsafe or redundant functions in library \`Option\` ( \`unwrap\`, \`assertSome\`, \`assertNull\`) (#275)
932
+
933
+ ## 0.6.6 (2021-07-30)
934
+
935
+ * Vastly improved garbage collection scheduling: previously Motoko runtime would do GC
936
+ after every update message. We now schedule a GC when
937
+
938
+ 1. Heap grows more than 50% and 10 MiB since the last GC, or
939
+ 2. Heap size is more than 3 GiB
940
+
941
+ (1) is to make sure we don't do GC on tiny heaps or after only small amounts of allocation.
942
+ (2) is to make sure that on large heaps we will have enough allocation space during the next message.
943
+
944
+ This scheduling reduces cycles substantially, but may moderately increase memory usage.
945
+
946
+ New flag \`--force-gc\` restores the old behavior.
947
+
948
+ * Fix bug in compacting gc causing unnecessary memory growth (#2673)
949
+
950
+ * Trap on attempt to upgrade when canister not stopped and there are outstanding callbacks.
951
+ (This failure mode can be avoided by stopping the canister before upgrade.)
952
+
953
+ * Fix issue #2640 (leaked \`ClosureTable\` entry when awaiting futures fails).
954
+
955
+ ## 0.6.5 (2021-07-08)
956
+
957
+ * Add alternative, _compacting_ gc, enabled with new moc flag \`--compacting-gc\`.
958
+ The compacting gc supports larger heap sizes than the default, 2-space copying collector.
959
+
960
+ NOTE: Dfx 0.7.6 adds optional field \`"args"\` to \`dfx.json\` files,
961
+ so Motoko canisters can specify \`moc\` command-line arguments. E.g.,
962
+
963
+ \`\`\`json
964
+ ...
965
+ "type" : "motoko"
966
+ ...
967
+ "args" : "--compacting-gc"
968
+ ...
969
+ \`\`\`
970
+
971
+ * Documentation fixes.
972
+ * Command line tools: \`--help\` option provides better documentation of command line
973
+ options that have arguments.
974
+ * Fix issue #2319 (crash on import of Candid class).
975
+
976
+ ## 0.6.4 (2021-06-12)
977
+
978
+ * For release builds, the banner (\`moc --version\`) now includes the release
979
+ version.
980
+
981
+ * Fix MacOS release builds (the 0.6.3 tarball for MacOS contained the linux binaries)
982
+
983
+ ## 0.6.3 (2021-06-10)
984
+
985
+ * Motoko is now open source!
986
+
987
+ * Better internal consistency checking of the intermediate representation
988
+
989
+ ## 0.6.2 (2021-05-24)
990
+
991
+ * motoko-base:
992
+
993
+ * reformat to style guidelines
994
+ * add type bindings \`Nat.Nat\`, \`Nat8.Nat8\` etc. to libraries for primitive types.
995
+
996
+ * Bugfix: generation of candid from Motoko:
997
+
998
+ * no longer confused by distinct, but eponymous, type definitions (Bug: #2529);
999
+ * numbers eponymous types and specializations from 1 (not 2);
1000
+ * avoids long chains of type equalities by normalizing before translation.
1001
+
1002
+ ## 0.6.1 (2021-04-30)
1003
+
1004
+ * Internal: Update to IC interface spec 0.17 (adapt to breaking change to signature of \`create_canister\`)
1005
+
1006
+ ## 0.6.0 (2021-04-16)
1007
+
1008
+ * BREAKING CHANGE:
1009
+ The old-style object and block syntax deprecated in 0.5.0 is finally removed.
1010
+
1011
+ * Record punning: As already supported in patterns, short object syntax in
1012
+ expressions now allows omitting the right-hand side if it is an identifier
1013
+ of the same name as the label. That is,
1014
+
1015
+ \`\`\`motoko
1016
+ {a; b = 1; var c}
1017
+ \`\`\`
1018
+
1019
+ is short for
1020
+
1021
+ \`\`\`motoko
1022
+ {a = a; b = 1; var c = c}
1023
+ \`\`\`
1024
+
1025
+ assuming respective variables are in scope.
1026
+
1027
+ * BREAKING CHANGE:
1028
+ The types \`Word8\`, \`Word16\`, \`Word32\` and \`Word64\` have been removed.
1029
+ This also removed the \`blob.bytes()\` iterator.
1030
+
1031
+ Motoko base also dropped the \`Word8\`, \`Word16\`, \`Word32\` and \`Word64\`
1032
+ modules.
1033
+
1034
+ This concludes the transition to the other fixed-width types that began with
1035
+ version 0.5.8
1036
+
1037
+ * BREAKING CHANGE (Minor):
1038
+ \`await\` on a completed future now also commits state and suspends
1039
+ computation, to ensure every await, regardless of its future's state,
1040
+ is a commit point for state changes and tentative message sends.
1041
+
1042
+ (Previously, only awaits on pending futures would force a commit
1043
+ and suspend, while awaits on completed futures would continue
1044
+ execution without an incremental commit, trading safety for speed.)
1045
+
1046
+ * motoko-base: fixed bug in \`Text.compareWith\`.
1047
+
1048
+ ## 0.5.15 (2021-04-13)
1049
+
1050
+ * Bugfix: \`Blob.toArray\` was broken.
1051
+
1052
+ ## 0.5.14 (2021-04-09)
1053
+
1054
+ * BREAKING CHANGE (Minor): Type parameter inference will no longer default
1055
+ under-constrained type parameters that are invariant in the result, but
1056
+ require an explicit type argument.
1057
+ This is to avoid confusing the user by inferring non-principal types.
1058
+
1059
+ For example, given (invariant) class \`Box<A>\`:
1060
+
1061
+ \`\`\`motoko
1062
+ class Box<A>(a : A) { public var value = a; };
1063
+ \`\`\`
1064
+
1065
+ the code
1066
+
1067
+ \`\`\`motoko
1068
+ let box = Box(0); // rejected
1069
+ \`\`\`
1070
+
1071
+ is rejected as ambiguous and requires an instantiation, type annotation or
1072
+ expected type. For example:
1073
+
1074
+ \`\`\`motoko
1075
+ let box1 = Box<Int>(0); // accepted
1076
+ let box2 : Box<Nat> = Box(0); // accepted
1077
+ \`\`\`
1078
+
1079
+ Note that types \`Box<Int>\` and \`Box<Nat>\` are unrelated by subtyping,
1080
+ so neither is best (or principal) in the ambiguous, rejected case.
1081
+
1082
+ * Bugfix: Type components in objects/actors/modules correctly ignored
1083
+ when involved in serialization, equality and \`debug_show\`, preventing
1084
+ the compiler from crashing.
1085
+
1086
+ * motoko-base: The \`Text.hash\` function was changed to a better one.
1087
+ If you stored hashes as stable values (which you really shouldn't!)
1088
+ you must rehash after upgrading.
1089
+
1090
+ * motoko-base: Conversion functions between \`Blob\` and \`[Nat8]\` are provided.
1091
+
1092
+ * When the compiler itself crashes, it will now ask the user to report the
1093
+ backtrace at the DFINITY forum
1094
+
1095
+ ## 0.5.13 (2021-03-25)
1096
+
1097
+ * The \`moc\` interpreter now pretty-prints values (as well as types) in the
1098
+ repl, producing more readable output for larger values.
1099
+
1100
+ * The family of \`Word\` types are deprecated, and mentioning them produces a warning.
1101
+ These type will be removed completely in a subsequent release.
1102
+ See the user’s guide, section “Word types”, for a migration guide.
1103
+
1104
+ * motoko base: because of this deprecation, the \`Char.from/toWord32()\`
1105
+ functions are removed. Migrate away from \`Word\` types, or use
1106
+ \`Word32.from/ToChar\` for now.
1107
+
1108
+ ## 0.5.12 (2021-03-23)
1109
+
1110
+ * The \`moc\` compiler now pretty-prints types in error messages and the repl,
1111
+ producing more readable output for larger types.
1112
+
1113
+ * motoko base: fixed bug in \`Text.mo\` affecting partial matches in,
1114
+ for example, \`Text.replace\` (GH issue #234).
1115
+
1116
+ ## 0.5.11 (2021-03-12)
1117
+
1118
+ * The \`moc\` compiler no longer rejects occurrences of private or
1119
+ local type definitions in public interfaces.
1120
+
1121
+ For example,
1122
+
1123
+ \`\`\`motoko
1124
+ module {
1125
+ type List = ?(Nat, List); // private
1126
+ public func cons(n : Nat, l : List) : List { ?(n , l) };
1127
+ }
1128
+ \`\`\`
1129
+
1130
+ is now accepted, despite \`List\` being private and appearing in the type
1131
+ of public member \`cons\`.
1132
+
1133
+ * Type propagation for binary operators has been improved. If the type of one of
1134
+ the operands can be determined locally, then the other operand is checked
1135
+ against that expected type. This should help avoiding tedious type annotations
1136
+ in many cases of literals, e.g., \`x == 0\` or \`2 * x\`, when \`x\` has a special
1137
+ type like \`Nat8\`.
1138
+
1139
+ * The \`moc\` compiler now rejects type definitions that are non-_productive_ (to ensure termination).
1140
+
1141
+ For example, problematic types such as:
1142
+
1143
+ \`\`\`motoko
1144
+ type C = C;
1145
+ type D<T, U> = D<U, T>;
1146
+ type E<T> = F<T>;
1147
+ type F<T> = E<T>;
1148
+ type G<T> = Fst<G<T>, Any>;
1149
+ \`\`\`
1150
+
1151
+ are now rejected.
1152
+
1153
+ * motoko base: \`Text\` now contains \`decodeUtf8\` and \`encodeUtf8\`.
1154
+
1155
+ ## 0.5.10 (2021-03-02)
1156
+
1157
+ * User defined deprecations
1158
+
1159
+ Declarations in modules can now be annotated with a deprecation comment, which make the compiler emit warnings on usage.
1160
+
1161
+ This lets library authors warn about future breaking changes:
1162
+
1163
+ As an example:
1164
+
1165
+ \`\`\`motoko
1166
+ module {
1167
+ /// @deprecated Use \`bar\` instead
1168
+ public func foo() {}
1169
+
1170
+ public func bar() {}
1171
+ }
1172
+ \`\`\`
1173
+
1174
+ will emit a warning whenever \`foo\` is used.
1175
+
1176
+ * The \`moc\` compiler now rejects type definitions that are _expansive_, to help ensure termination.
1177
+ For example, problematic types such as \`type Seq<T> = ?(T, Seq<[T]>)\` are rejected.
1178
+
1179
+ * motoko base: \`Time.Time\` is now public
1180
+
1181
+ ## 0.5.9 (2021-02-19)
1182
+
1183
+ * The \`moc\` compiler now accepts the \`-Werror\` flag to turn warnings into errors.
1184
+
1185
+ * The language server now returns documentation comments alongside
1186
+ completions and hover notifications
1187
+
1188
+ ## 0.5.8 (2021-02-12)
1189
+
1190
+ * Wrapping arithmetic and bit-wise operations on \`NatN\` and \`IntN\`
1191
+
1192
+ The conventional arithmetic operators on \`NatN\` and \`IntN\` trap on overflow.
1193
+ If wrap-around semantics is desired, the operators \`+%\`, \`-%\`, \`*%\` and \`**%\`
1194
+ can be used. The corresponding assignment operators (\`+%=\` etc.) are also available.
1195
+
1196
+ Likewise, the bit fiddling operators (\`&\`, \`|\`, \`^\`, \`<<\`, \`>>\`, \`<<>\`,
1197
+ \`<>>\` etc.) are now also available on \`NatN\` and \`IntN\`. The right shift
1198
+ operator (\`>>\`) is an unsigned right shift on \`NatN\` and a signed right shift
1199
+ on \`IntN\`; the \`+>>\` operator is _not_ available on these types.
1200
+
1201
+ The motivation for this change is to eventually deprecate and remove the
1202
+ \`WordN\` types.
1203
+
1204
+ Therefore, the wrapping arithmetic operations on \`WordN\` are deprecated and
1205
+ their use will print a warning. See the user’s guide, section “Word types”,
1206
+ for a migration guide.
1207
+
1208
+ * For values \`x\` of type \`Blob\`, an iterator over the elements of the blob
1209
+ \`x.vals()\` is introduced. It works like \`x.bytes()\`, but returns the elements
1210
+ as type \`Nat8\`.
1211
+
1212
+ * \`mo-doc\` now generates cross-references for types in signatures in
1213
+ both the Html as well as the Asciidoc output. So a signature like
1214
+ \`fromIter : I.Iter<Nat> -> List.List<Nat>\` will now let you click on
1215
+ \`I.Iter\` or \`List.List\` and take you to their definitions.
1216
+
1217
+ * Bugfix: Certain ill-typed object literals are now prevented by the type
1218
+ checker.
1219
+
1220
+ * Bugfix: Avoid compiler aborting when object literals have more fields than
1221
+ their type expects.
1222
+
1223
+ ## 0.5.7 (2021-02-05)
1224
+
1225
+ * The type checker now exploits the expected type, if any,
1226
+ when typing object literal expressions.
1227
+ So \`{ x = 0 } : { x : Nat8 }\` now works as expected
1228
+ instead of requiring an additional type annotation on \`0\`.
1229
+
1230
+ ## 0.5.6 (2021-01-22)
1231
+
1232
+ * The compiler now reports errors and warnings with an additional _error code_
1233
+ This code can be used to look up a more detailed description for a given error by passing the \`--explain\` flag with a code to the compiler.
1234
+ As of now this isn't going to work for most codes because the detailed descriptions still have to be written.
1235
+ * Internal: The parts of the RTS that were written in C have been ported to Rust.
1236
+
1237
+ ## 0.5.5 (2021-01-15)
1238
+
1239
+ * new \`moc\` command-line arguments \`--args <file>\` and \`--args0 <file>\` for
1240
+ reading newline/NUL terminated arguments from \`<file>\`.
1241
+ * motoko base: documentation examples are executable in the browser
1242
+
1243
+ ## 0.5.4 (2021-01-07)
1244
+
1245
+ * _Option blocks_ \`do ? <block>\` and _option checks_ \`<exp> !\`.
1246
+ Inside an option block, an option check validates that its operand expression is not \`null\`.
1247
+ If it is, the entire option block is aborted and evaluates to \`null\`.
1248
+ This simplifies consecutive null handling by avoiding verbose \`switch\` expressions.
1249
+
1250
+ For example, the expression \`do? { f(x!, y!) + z!.a }\` evaluates to \`null\` if either \`x\`, \`y\` or \`z\` is \`null\`;
1251
+ otherwise, it takes the options' contents and ultimately returns \`?r\`, where \`r\` is the result of the addition.
1252
+
1253
+ * BREAKING CHANGE (Minor):
1254
+ The light-weight \`do <exp>\` form of the recently added, more general \`do <block-or-exp>\` form,
1255
+ is no longer legal syntax.
1256
+ That is, the argument to a \`do\` or \`do ?\` expression *must* be a block \`{ ... }\`,
1257
+ never a simple expression.
1258
+
1259
+ ## 0.5.3 (2020-12-10)
1260
+
1261
+ * Nothing new, just release moc.js to CDN
1262
+
1263
+ ## 0.5.2 (2020-12-04)
1264
+
1265
+ * Bugfix: gracefully handle importing ill-typed actor classes
1266
+
1267
+ ## 0.5.1 (2020-11-27)
1268
+
1269
+ * BREAKING CHANGE: Simple object literals of the form \`{a = foo(); b = bar()}\`
1270
+ no longer bind the field names locally. This enables writing expressions
1271
+ like \`func foo(a : Nat) { return {x = x} }\`.
1272
+
1273
+ However, this breaks expressions like \`{a = 1; b = a + 1}\`. Such object
1274
+ shorthands now have to be written differently, e.g., with an auxiliary
1275
+ declaration, as in \`let a = 1; {a = a; b = a + 1}\`, or by using the "long"
1276
+ object syntax \`object {public let a = 1; public let b = a + 1}\`.
1277
+
1278
+ ## 0.5.0 (2020-11-27)
1279
+
1280
+ * BREAKING CHANGE: Free-standing blocks are disallowed
1281
+
1282
+ Blocks are only allowed as sub-expressions of control flow expressions like
1283
+ \`if\`, \`loop\`, \`case\`, etc. In all other places, braces are always considered
1284
+ to start an object literal.
1285
+
1286
+ To use blocks in other positions, the new \`do <block>\` expression can be
1287
+ used.
1288
+
1289
+ The more liberal syntax is still allowed for now but deprecated, i.e.,
1290
+ produces a warning.
1291
+
1292
+ * BREAKING CHANGE: actor creation is regarded as asynchronous:
1293
+
1294
+ * Actor declarations are asynchronous and can only be used in asynchronous
1295
+ contexts.
1296
+ * The return type of an actor class, if specified, must be an async actor
1297
+ type.
1298
+ * To support actor declaration, the top-level context of an interpreted
1299
+ program is an asynchronous context, allowing implicit and explicit await
1300
+ expressions.
1301
+
1302
+ (Though breaking, this change mostly affects interpreted programs and
1303
+ compiled programs with explicate actor class return types)
1304
+
1305
+ * Candid support is updated to latest changes of the Candid spec, in particular
1306
+ the ability to extend function with optional parameters in a backward
1307
+ compatible way.
1308
+
1309
+ Motoko passes the official Candid compliance test suite.
1310
+
1311
+ * RTS: Injecting a value into an option type (\`? <exp>\`) no longer
1312
+ requires heap allocation in most cases. This removes the memory-tax
1313
+ of using iterators.
1314
+
1315
+ * Bugfix: Passing cycles to the instantiation of an actor class works now.
1316
+
1317
+ * Various bug fixes and documentation improvements.
1318
+
1319
+ ## 0.4.6 (2020-11-13)
1320
+
1321
+ * Significant documentation improvements
1322
+ * Various bugfixes
1323
+ * Improved error messages
1324
+ * Initial DWARF support
1325
+ * Candid compliance improvements:
1326
+ * Strict checking of utf8 strings
1327
+ * More liberal parsing of leb128-encoded numbers
1328
+ * New motoko-base:
1329
+ * The Random library is added
1330
+
1331
+ ## 0.4.5 (2020-10-06)
1332
+
1333
+ * BREAKING CHANGE: a library containing a single actor class is
1334
+ imported as a module, providing access to both the class type and
1335
+ class constructor function as module components. Restores the
1336
+ invariant that imported libraries are modules.
1337
+ * Backend: Compile captured actor class parameters statically (#2022)
1338
+ * flip the default for -g (#1546)
1339
+ * Bug fix: reject array indexing as non-static (could trap) (#2011)
1340
+ * Initialize tuple length fields (#1992)
1341
+ * Warns for structural equality on abstract types (#1972)
1342
+ * Funds Imperative API (#1922)
1343
+ * Restrict subtyping (#1970)
1344
+ * Continue labels always have unit codomain (#1975)
1345
+ * Compile.ml: target and use new builder call pattern (#1974)
1346
+ * fix scope var bugs (#1973)
1347
+
1348
+ ## 0.4.4 (2020-09-21)
1349
+
1350
+ * Actor class export
1351
+ * Accept unit installation args for actors
1352
+ * Reject platform actor (class) programs with additional decs
1353
+ * Handle IO exceptions at the top-level
1354
+ * RTS: Remove duplicate array and blob allocation code
1355
+ * RTS: Fix pointer arithmetic in BigInt collection function
1356
+
1357
+ ## 0.4.3 (2020-09-14)
1358
+
1359
+ * Preliminary support for actor class import and dynamic canister installation.
1360
+ Surface syntax may change in future.
1361
+ * BREAKING CHANGE: a compilation unit/file defining an actor or actor class may *only* have leading \`import\` declarations; other leading declarations (e.g. \`let\` or \`type\`) are no longer supported.
1362
+ * Rust GC
1363
+
1364
+ ## 0.4.2 (2020-08-18)
1365
+
1366
+ * Polymorphic equality. \`==\` and \`!=\` now work on all shareable types.
1367
+
1368
+ ## 0.4.1 (2020-08-13)
1369
+
1370
+ * Switching to bumping the third component of the version number
1371
+ * Bugfix: clashing declarations via function and class caught (#1756)
1372
+ * Bugfix: Candid \`bool\` decoding rejects invalid input (#1783)
1373
+ * Canisters can take installation arguments (#1809)
1374
+ NB: Communicating the type of the canister installation methods is still
1375
+ missing.
1376
+ * Optimization: Handling of \`Bool\` in the backend.
1377
+
1378
+ ## 0.4 (2020-08-03)
1379
+
1380
+ * Candid pretty printer to use shorthand when possible (#1774)
1381
+ * fix candid import to use the new id format (#1787)
1382
+
1383
+ ## 0.3 (2020-07-31)
1384
+
1385
+ * Fixes an issue with boolean encoding to Candid
1386
+ * Converts the style guide to asciidocs
1387
+
1388
+ ## 0.2 (2020-07-30)
1389
+
1390
+ * The \`Blob\` type round-trips through candid type export/import (#1744)
1391
+ * Allow actor classes to know the caller of their constructor (#1737)
1392
+ * Internals: \`Prim.time()\` provided (#1747)
1393
+ * Performance: More dead code removal (#1752)
1394
+ * Performance: More efficient arithmetic with unboxed values (#1693, #1757)
1395
+ * Canister references are now parsed and printed according to the new
1396
+ base32-based textual format (#1732).
1397
+ * The runtime is now embedded into \`moc\` and need not be distributed separately
1398
+ (#1772)
1399
+
1400
+ ## 0.1 (2020-07-20)
1401
+
1402
+ * Beginning of the changelog. Released with dfx-0.6.0.
1403
+
1404
+ 0.111 (2020-07-20)
1405
+ =========
1406
+
1407
+ 0.22222
1408
+ ----
1409
+
1410
+ * Beginning of the changelog. Released with dfx-0.6.0.
1411
+ `;
1412
+ let tree = fromMarkdown(str);
1413
+ let found = false;
1414
+ let nodes = [];
1415
+ for (let node of tree.children) {
1416
+ if (found) {
1417
+ if (node.type === 'heading') {
1418
+ break;
1419
+ }
1420
+ else {
1421
+ nodes.push(node);
1422
+ }
1423
+ }
1424
+ else if (node.type === 'heading' && toMarkdown(node).match(new RegExp('\\b0.9.41\\b'))) {
1425
+ found = true;
1426
+ }
1427
+ }
1428
+ // tree.children.find((node) => {
1429
+ // })
1430
+ console.log(toMarkdown({
1431
+ type: 'root',
1432
+ children: nodes,
1433
+ }));
1434
+ // console.log(markdownHeadings(''));
1435
+ // console.log(markdownHeadings(str).find((x: string) => x.match(new RegExp('\\b0.6.13\\b'))));