Thank you, I will correct that.
(Reason I wrote that is that it isn’t mentioned in the Language Quick Reference - Subtyping section. )
On the second point: I will remove the NOTE and think about making a clear distinction for Motoko and Candid subtyping after experimenting a bit with both.
Specifically, in Candid, object supertypes can have
more fields as well, as long as those are optional. Dually, variant supertypes can have fewer fields as well, as long as the whole variant is optional. That greatly extends the set of changes that are legal and safe for upgrades…
Aah ok! I’m learning as I go! I will have to cover this separately.
Thanks a lot! (and sorry for spamming this thread
It actually is, though easy to miss:
actor is one of the possible
sorts that occur in the subtyping rule for object types. Other sorts are
module; all of them are different forms of object type.
I included all your corrections
There’s actually a different error in the description of subtyping between object-like types.
It should say that every field in the supertype appears in the subtype, but gets that bit the wrong way round.
Docs: should actor subtyping be mentioned in the Quick Reference? · Issue #3846 · dfinity/motoko · GitHub tracks both issues.