Stream: general

Topic: component naming conventions and WIT directory structure


view this post on Zulip nikomatsakis (Nov 27 2024 at 10:03):

I don't understand the conventions around .wit files in a directory. For example, this file does not declare a package:

https://github.com/WebAssembly/wasi-cli/blob/main/wit/terminal.wit

...but this one does...

https://github.com/WebAssembly/wasi-cli/blob/main/wit/command.wit

why?

Also, are package names always "namespace:package-name" and everything under that package is an interface or world defined within? Is there substructure?

The component model explainer is quite silent on basics like this (or I missed it). I've also been browsing the specification but I guess I didn't find the right section.

Command-Line Interface (CLI) World for WASI. Contribute to WebAssembly/wasi-cli development by creating an account on GitHub.
Command-Line Interface (CLI) World for WASI. Contribute to WebAssembly/wasi-cli development by creating an account on GitHub.

view this post on Zulip nikomatsakis (Nov 27 2024 at 10:28):

Also, why do I see things like this:

use wasi:io/streams@0.2.2.{output-stream}

I believe versioning is on wasi:io not wasi:io/streams, so I would expect wasi:io@0.2.2/streams. Am I wrong about how versioning works? And the change between / and . suggests that there is only one level within a wasm package, is that reasonable?

i.e., is the full structure namespace/package/interface-or-world@version.type-name or is it something more recursive?

view this post on Zulip nikomatsakis (Nov 27 2024 at 10:58):

Ah, I found the answer to my first question ("why does one file say package and not others") here:

If a package spans multiple files, only one file needs to contain a package declaration (but if multiple files contain declarations then they must all be the same).

and based on what I'm reading I think the answer to this question:

i.e., is the full structure namespace/package/interface-or-world@version.type-name or is it something more recursive?

is "yes" and that

I believe versioning is on wasi:io not wasi:io/streams

is correct

view this post on Zulip Lann Martin (Nov 27 2024 at 13:44):

fwiw I also find the interface version syntax to be counterintuitive


Last updated: Dec 23 2024 at 12:05 UTC