Using variant variables in the Canister public interface return value breaks composability

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.

Aah ok! I’m learning as I go! I will have to cover this separately.

Thanks a lot! (and sorry for spamming this thread :sweat_smile:)

1 Like

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 object and module; all of them are different forms of object type.

1 Like

Got it!

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.