Skip to content

Commit fafa1f2

Browse files
committed
Clarify type equality for handles and lists of handles
1 parent 08cbd80 commit fafa1f2

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

design/mvp/Explainer.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -837,23 +837,33 @@ the types `$T2` and `$T3` are equal to each other but not to `$T1`. By the
837837
above transitive structural equality rules, the types `$List2` and `$List3` are
838838
equal to each other but not to `$List1`.
839839

840-
Handle types (`own` and `borrow`) are purely structural, but, since they refer
841-
to resource types, transitively "inherit" the freshness of abstract resource
842-
types. For example, in the following component:
840+
Handle types (`own` and `borrow`) are structural types (like `list`) but, since
841+
they refer to resource types, transitively "inherit" the freshness of abstract
842+
resource types. For example, in the following component:
843843
```wasm
844844
(component
845845
(import "T" (type $T (sub resource)))
846846
(import "U" (type $U (sub resource)))
847-
(type $Handle1 (own $T))
848-
(type $Handle2 (own $T))
849-
(type $Handle3 (own $U))
847+
(type $Own1 (own $T))
848+
(type $Own2 (own $T))
849+
(type $Own3 (own $U))
850+
(type $ListOwn1 (list $Own1))
851+
(type $ListOwn2 (list $Own2))
852+
(type $ListOwn3 (list $Own3))
853+
(type $Borrow1 (borrow $T))
854+
(type $Borrow2 (borrow $T))
855+
(type $Borrow3 (borrow $U))
856+
(type $ListBorrow1 (list $Borrow1))
857+
(type $ListBorrow2 (list $Borrow2))
858+
(type $ListBorrow3 (list $Borrow3))
850859
)
851860
```
852-
the types `$Handle1` and `$Handle2` are equal to each other but not to
853-
`$Handle3`. Transitively, any types containing `$Handle1` or `$Handle2` are
854-
equal, such as a `(list $Handle1)` and `(list $Handle2)` or function types
855-
using handles in their parameters and results. These type-checking rules for
856-
type imports mirror the *introduction* rule of [universal types] (∀T).
861+
the types `$Own1` and `$Own2` are equal to each other but not to `$Own3` or
862+
any of the `$Borrow*`. Similarly, `$Borrow1` and `$Borrow2` are equal to
863+
each other but not `$Borrow3`. Transitively, the types `$ListOwn1` and
864+
`$ListOwn2` are equal to each other but not `$ListOwn3` or any of the
865+
`$ListBorrow*`. These type-checking rules for type imports mirror the
866+
*introduction* rule of [universal types] (∀T).
857867

858868
The above examples all show abstract types in terms of *imports*, but the same
859869
"freshness" condition applies when aliasing the *exports* of another component

0 commit comments

Comments
 (0)