Enable more than one handle
type in *.witx
#421
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit reworks how handle types work at the representation level in
*.witx
file to follow the expected design of resources in theinterface types specification. Previously handle types were simply
(handle)
, which meant that there could only be one actual handle typein 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:This declares that the module exports a type named
$fd
and it'sabstract in that the representation is not known. At the interface layer
you can't pass an
$fd
directly because it's representation is notknown. To do that, however, you can do:
The
handle
type now refers to a particularresource
that it refersto. Values of type
handle T
can exist and are what's passed at theboundaries.
This is all largely just an internal structuring concern at this point.
This has no ramifications for WASI which still has an
$fd
type forfunctions that is represented with an
i32
. This is largely aforward-looking change to allow multiple types of resources defined by
different modules and all used by one another.
This commit also updates
use
syntax whereuse
will pull from eitherthe type or the resource namespace. Furthermore a new
(use ($foo as $bar) ...)
syntax was added to locally renamed something within a module.