Skip to content

Commit 60df3c7

Browse files
committed
Maybe clarify the existential intro rule (we'll see)
1 parent 475c855 commit 60df3c7

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

design/mvp/Explainer.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -928,18 +928,21 @@ the fact that the underlying concrete type is the same is kept an encapsulated
928928
implementation detail. For example, in the following component:
929929
```wasm
930930
(component
931-
(component $C
932-
(type $r (resource (rep i32)))
933-
(export "r1" (type (sub $r)))
934-
(export "r2" (type (sub $r)))
935-
)
936-
(instance $c (instantiate $C))
937-
(type $r1 (alias export $c "r1"))
938-
(type $r2 (alias export $c "r2"))
931+
(type $r (resource (rep i32)))
932+
(export "r1" (type (sub $r)))
933+
(export "r2" (type (sub $r)))
934+
)
935+
```
936+
Any client of this component will treat `r1` and `r2` as totally distinct
937+
types since this component definition has the `componenttype`:
938+
```wasm
939+
(component
940+
(export "r1" (type (sub resource)))
941+
(export "r2" (type (sub resource)))
939942
)
940943
```
941-
The types `$r1` and `$r2` are unequal. These type-checking rules for
942-
type exports mirror the *introduction* rule of [existential types] (∃T).
944+
The assignment of this type to the above component mirrors the *introduction*
945+
rule of [existential types] (∃T).
943946

944947
When supplying a resource type (imported *or* defined) to a type import via
945948
`instantiate`, type checking performs a substitution, replacing all uses of the

0 commit comments

Comments
 (0)