-
Notifications
You must be signed in to change notification settings - Fork 83
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
WIT: world extern-type
rule is too restrictive
#287
Comments
In terms of parsing I think that's easy enough to fix with a bit more lookahead on the |
Regarding how the WIT<-->binary roundtrip could work (which I think might run into some trouble trying to use imports/exports on first consideration): one alternative (but maybe bad) idea is to add and use an The original idea of So, building on this C-M idea: maybe the WIT-level meaning of this new syntactic form @peterhuene is suggesting (which I agree seems useful) is that |
That seems plausible to me yeah, the validation of the |
FTR, I made the same observation. If you want WIT to scale, then there really ought to be a declaration form for naming interface types. (And as Luke is aware, I strongly believe that the off interpretation of "interface" in WIT is at odds with doing this in the natural manner. ;) ) |
Capturing a point made earlier by @dicej for posterity: as soon as you add this feature, you also want a complementary extension to WIT to be able to refer to the |
Currently the
extern-type
rule in the WIT grammar is:This means that both the
import-item
andexport-item
rules in a world may only have named function or inlined interface items.For example:
However, it may be desirable to have a single interface definition that is imported or exported under different names in a world or to simply import or export a "known" interface with a different kebab name.
The former is currently not possible in the grammar, but it is possible with copy-and-paste:
This obviously duplicates the type information on every inline interface definition.
What I propose with this issue is to add
use-path
as a case to theextern-type
rule.This would allow for the following:
and also for:
Note: there may be ambiguity introduced by extending the
extern-type
rule in the currentwit-parser
implementation as right now it allows lexingfoo: bar
as a package name made up of three tokens (<id>
,':'
,<id>
); a hypotheticalimport foo: bar:baz/qux
in a world might be difficult for it to parse as it will likely see that as an import of a package path with nested namespaces. Thewac
parser lexes package paths as individual tokens and therefore prohibits whitespace in the path, so that would lex as<import-keyword>
,<id>
,:
,<package-path>
rather than<import-keyword>
,<package-path>
.The text was updated successfully, but these errors were encountered: