Thanks again for the quick fixes on the earlier issues!
Context: we're migrating our Internet Computer skills site (dfinity/icskills) to sync writing-motoko, migrating-motoko-actors, and troubleshooting-motoko-migrations from here. As part of that we compared the content we're replacing (our older Motoko skill) against the new writing-motoko corpus (SKILL.md + api-reference.md + examples.md + references/*).
writing-motoko is richer than our old skill in most areas (mops toolchain, Nat-arithmetic safety, numeric-conversion hygiene, text search/case folding, array sorting, a much larger error table, the API reference). But a handful of general (non-Caffeine) Motoko items our old skill covered aren't in the new corpus anywhere. We'd like to sync the core generically, so rather than carry these as local patches we'd prefer they live upstream — could you consider adding them? (If you'd rather they stay out of scope, that's fine too — we'll drop them on our side. Just want an explicit decision so we're not silently diverging.)
1. How enhanced orthogonal persistence is actually enabled
The body says state persists "without the stable keyword" but never explains how EOP is turned on. On Caffeine the mops toolchain sets this automatically, so it's invisible — but a general reader compiling with moc/mops manually hits M0220 with no guidance. Our old skill had:
--default-persistent-actors all actors are `persistent`, no `stable` keyword needed
--enhanced-orthogonal-persistence is on by default. Without --default-persistent-actors, plain actor { } errors with M0220 — write persistent actor { } instead (the persistent keyword is transitional; actors become persistent-by-default in a future major moc release).
Plus the auto-fixable style-enforcement warnings that back the skill's own conventions: -W M0236 (non-dot-notation calls), -W M0237 (redundant explicit implicit args), -W M0223 (redundant type instantiation).
2. Error-table rows dropped
Present in our old table, not in the new one:
| Error |
Meaning |
Fix |
M0220 |
actor should be declared persistent |
--default-persistent-actors or persistent actor |
M0141 |
type/let declared before the actor body |
move them into the body / into types.mo |
M0218 |
redundant stable keyword |
remove stable (plain var is auto-stable) |
M0064 |
misplaced '!' |
wrap in do ? { ... } |
M0145 |
pattern does not cover value |
add missing cases or case _ |
(We had previously flagged M0064 and M0145 upstream at caffeinelabs/motoko — issues #6157 and #6156 — but since that repo is being retired, re-surfacing here.)
3. Pitfalls dropped
Text.join parameter order — iterator first, separator second: Text.join(["a","b"].values(), ", "). Easy to invert.
type/let before the actor body (M0141) — only imports may precede the actor; move types into types.mo.
- Parenthesize variant tag arguments —
#tag(x), never #tag x (#tag 1 + 2 parses as #tag(1) + 2).
- Never annotate lambda argument types — the compiler infers them; annotating is redundant and often wrong.
4. Reference material dropped
- Full Reserved Keywords list. The new corpus names
query/label as reserved (Critical Requirements + one error row) but has no enumerated list. Our old skill listed all of them (actor and assert async await break case … with, plus the async*/await*/await? note) so an agent can check an identifier before using it.
- Equality & Comparison breakdown. Which
mo:core modules expose a self-callable .equal (Text, Principal, Bool, Char, Blob) vs the x, y form (Nat, Int, Float, sized ints), and that == is compiler-generated structural equality while equal/compare are primarily implicit arguments for Map/Set/contains.
do ? { ... } option-chaining construct (the counterpart to the M0064 misplaced-! fix above).
None of these are Caffeine-specific — they're general Motoko/moc correctness items. Happy to open a PR adding them to writing-motoko if that's easier than doing it yourselves. And if any are intentionally omitted, just let us know and we'll drop them on our side.
Thanks again for the quick fixes on the earlier issues!
Context: we're migrating our Internet Computer skills site (dfinity/icskills) to sync
writing-motoko,migrating-motoko-actors, andtroubleshooting-motoko-migrationsfrom here. As part of that we compared the content we're replacing (our older Motoko skill) against the newwriting-motokocorpus (SKILL.md +api-reference.md+examples.md+references/*).writing-motokois richer than our old skill in most areas (mops toolchain, Nat-arithmetic safety, numeric-conversion hygiene, text search/case folding, array sorting, a much larger error table, the API reference). But a handful of general (non-Caffeine) Motoko items our old skill covered aren't in the new corpus anywhere. We'd like to sync the core generically, so rather than carry these as local patches we'd prefer they live upstream — could you consider adding them? (If you'd rather they stay out of scope, that's fine too — we'll drop them on our side. Just want an explicit decision so we're not silently diverging.)1. How enhanced orthogonal persistence is actually enabled
The body says state persists "without the
stablekeyword" but never explains how EOP is turned on. On Caffeine the mops toolchain sets this automatically, so it's invisible — but a general reader compiling withmoc/mops manually hitsM0220with no guidance. Our old skill had:--enhanced-orthogonal-persistenceis on by default. Without--default-persistent-actors, plainactor { }errors with M0220 — writepersistent actor { }instead (thepersistentkeyword is transitional; actors become persistent-by-default in a future majormocrelease).Plus the auto-fixable style-enforcement warnings that back the skill's own conventions:
-W M0236(non-dot-notation calls),-W M0237(redundant explicit implicit args),-W M0223(redundant type instantiation).2. Error-table rows dropped
Present in our old table, not in the new one:
M0220--default-persistent-actorsorpersistent actorM0141type/letdeclared before the actor bodytypes.moM0218stablekeywordstable(plainvaris auto-stable)M0064misplaced '!'do ? { ... }M0145pattern does not cover valuecase _(We had previously flagged
M0064andM0145upstream atcaffeinelabs/motoko— issues #6157 and #6156 — but since that repo is being retired, re-surfacing here.)3. Pitfalls dropped
Text.joinparameter order — iterator first, separator second:Text.join(["a","b"].values(), ", "). Easy to invert.type/letbefore the actor body (M0141) — onlyimports may precede the actor; move types intotypes.mo.#tag(x), never#tag x(#tag 1 + 2parses as#tag(1) + 2).4. Reference material dropped
query/labelas reserved (Critical Requirements + one error row) but has no enumerated list. Our old skill listed all of them (actor and assert async await break case … with, plus theasync*/await*/await?note) so an agent can check an identifier before using it.mo:coremodules expose a self-callable.equal(Text,Principal,Bool,Char,Blob) vs thex, yform (Nat,Int,Float, sized ints), and that==is compiler-generated structural equality whileequal/compareare primarily implicit arguments forMap/Set/contains.do ? { ... }option-chaining construct (the counterpart to theM0064misplaced-!fix above).None of these are Caffeine-specific — they're general Motoko/
moccorrectness items. Happy to open a PR adding them towriting-motokoif that's easier than doing it yourselves. And if any are intentionally omitted, just let us know and we'll drop them on our side.