Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is “completeness of subtyping” #132

Open
nomeata opened this issue Nov 3, 2020 · 1 comment
Open

What is “completeness of subtyping” #132

nomeata opened this issue Nov 3, 2020 · 1 comment

Comments

@nomeata
Copy link
Collaborator

nomeata commented Nov 3, 2020

The spec currently says

Completeness: Subtyping covers all cases of successful deserialisation.

and I wonder what that precisely means, and if we really want it.

(Previous discussion at #128 (comment) )

@nomeata
Copy link
Collaborator Author

nomeata commented Nov 3, 2020

The wording above suggests

(∀ v. v :? T ~> _ ⇒ v :? T' ~> _) ⇒ T <: T'

But that does not hold as stated, for two reasons:

  • Any empty type would need to be a subtype of any type, e.g. opt empty <: null, or Empty <: t where type Empty = rec { Empty } or vec Empty <: vec t
  • Decoding of references (functions, sevices) doesn't actually fail eagerly, but causes subsequent uses of such a reference to fail.

One attempt might be “Subtyping is the largest relation that is transitive and sound (in the sense of the IDL-Soundness document)”. This is quite declarative and realtively elegant, I think, and I believe it implies the local soundess of deserialization.

It still requires Empty <: t, but it seems all “natural” definitions will lead to that. If we want to rule out that then maybe we have to do say something handwavy like “, … with exceptions for types that contain empty types”.

Maybe allowing Empty <: t and variant {} <: t isn’t actually so bad?

ninegua pushed a commit to ninegua/candid that referenced this issue Apr 22, 2022
ninegua pushed a commit to ninegua/candid that referenced this issue Apr 22, 2022
This includes a change to request_id from the identity-provider PR
(dfinity#132) that I thought was related to something else, but is essential
here with the new lerna packages.

This moves the CI to using lerna entirely, and prevents running
npm install (instead telling the user to run npx lerna bootstrap).
ninegua pushed a commit to ninegua/candid that referenced this issue Apr 22, 2022
Co-authored-by: Hans Larsen <hans@larsen.online>
Co-authored-by: Andrew Wylde <andrew.wylde@dfinity.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant