Package namespaces and package names are not generatable in combination
Looking at the wit-syntax the following is supported
package-decl ::= 'package' ( id ':' )+ id ( '/' id )* ('@' valid-semver)? ';'
Using it
package com:mydomain/tree/leaf;
interface foo {
record stat {
ino: u64,
size: u64,
}
}
world x { export foo; }
Generating fails with
tool@6fddbba60b7a:/workspaces/test_wit# wit-bindgen rust my_interface.wit
Error: expected '{', found /
--> my_interface.wit:1:21
|
1 | package com:mydomain/tree/leaf;
| ^
I think this should be supported
Thanks for the report! I'll note that the structure of com:mydomain/tree/leaf is "emoji gated" in the component model at this time meaning it's not fully stable and implemented everywhere. What you're running into is that this is an example of it not being implemented.
Does wit-bindgen have appetite for a PR for this? Or would you rather wait for the emoji to go away
I think this'd be reasonable to support yeah, but I'd also caution you in that there's probably work to be done in the wasm-tools repository to fully support this feature of the component model. In that sense while I'm not exactly sure what the extent of work necessary is I'd predict that this wouldn't be a small PR to support this. (but happy to be proven wrong!)
Actually I don't understand the purpose of ( '/' id )* in the production for package-decl. I thought the ID(s) after the slash were for sub-package objects like a world or an interface. So, why is it part of the package declaration?
That might be dated, and/or not fully thought out. The design of extended package names was never fully fleshed out and/or rationalized with WIT. There's a lot of open questions I suspect, like the one you're running into.