Skip to content

Document fully qualified worlds in generate! #1299

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/guest-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,14 @@
/// // The name of the world that bindings are being generated for. If this
/// // is not specified then it's required that the package selected
/// // below has a single `world` in it.
/// //
/// // Optionally, you can specify the fully qualified path to the world
/// // to read from the `wit/deps` folder:
/// //
/// // "example:test/my-world"
/// //
/// // This would read from your `my-world.wit` file in
/// // `wit/deps/example:test/my-world`.
Comment on lines +652 to +653
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify this slightly, the names of folders within wit/deps are insignificant and are only used for deduplicating packages. The package example:test can be within wit/deps/test or wit/deps/example equally. It's the contents of the *.wit files within that folder which dictate the package name.

Additionally the name my-world doesn't have to match the name of the WIT file itself, for example you could have world my-world { ... } in wit/deps/test/test.wit. You could even go further with a single-file package and have wit/deps/test.wit which contains package example:test; and world my-world { .. }.

Mostly would you ok relaxing the filename recommendation here? The wording currently reads as if it's required to be in such a location which may cause confusion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with it. I wasn't aware that things were so relaxed. I've been naming things after the worlds to be safe.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, you do not wish to change the wording here? If so I can incorporate this change in a separate PR but personally I won't merge this until the wording no longer implies that such filesystem naming is required.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with changing the wording. I'll think about it overnight and file a suggestion in this thread.

/// world: "my-world",
///
/// // Path to parse WIT and its dependencies from. Defaults to the `wit`
Expand Down
Loading