You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit reworks how handle types work at the representation level in
`*.witx` file to follow the expected design of resources in the
interface types specification. Previously handle types were simply
`(handle)`, which meant that there could only be one actual handle type
in the world (structurally at least). After this commit, however, there
can be multiple handle types.
First abstract types must be introduced as a `resource`, for example:
(resource $fd)
This declares that the module exports a type named `$fd` and it's
abstract in that the representation is not known. At the interface layer
you can't pass an `$fd` directly because it's representation is not
known. To do that, however, you can do:
(param $x (handle $fd))
The `handle` type now refers to a particular `resource` that it refers
to. Values of type `handle T` can exist and are what's passed at the
boundaries.
This is all largely just an internal structuring concern at this point.
This has no ramifications for WASI which still has an `$fd` type for
functions that is represented with an `i32`. This is largely a
forward-looking change to allow multiple types of resources defined by
different modules and all used by one another.
This commit also updates `use` syntax where `use` will pull from either
the type or the resource namespace. Furthermore a new `(use ($foo as
$bar) ...)` syntax was added to locally renamed something within a module.
0 commit comments