From 6d7760255cbb199833ca9b630f03b633cd58ffa4 Mon Sep 17 00:00:00 2001 From: Randolf Jung Date: Fri, 23 Oct 2026 13:59:33 -0700 Subject: [PATCH] Use local interfaces in the `implements` examples The examples of labelled imports and exports used `wasi:keyvalue/store` and `wasi:http/handler`. Use the `local:demo` interfaces that the rest of WIT.md uses instead, so the examples don't read as a statement about which WASI interfaces hosts should support under a label. --- design/mvp/Explainer.md | 18 +++++++++--------- design/mvp/WIT.md | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/design/mvp/Explainer.md b/design/mvp/Explainer.md index 1e4227627..6759b0748 100644 --- a/design/mvp/Explainer.md +++ b/design/mvp/Explainer.md @@ -2698,7 +2698,7 @@ import or export itself. For example: ```wat (component (import "wasi:http/types@0.2" (version-suffix ".6") (instance ...)) - (import "primary" (implements "wasi:keyvalue/store@0.2") (version-suffix ".1") (instance ...)) + (import "primary" (implements "local:demo/store@0.2") (version-suffix ".1") (instance ...)) ) ``` @@ -2708,16 +2708,16 @@ import or export the same `interfacename` multiple times (with different names). For example: ```wat (component - (import "primary" (implements "wasi:keyvalue/store") (instance ...)) - (import "secondary" (implements "wasi:keyvalue/store") (instance ...)) + (import "primary" (implements "local:demo/store") (instance ...)) + (import "secondary" (implements "local:demo/store") (instance ...)) ) ``` This ensures that imports and exports continue to have unique names (so that, e.g., guest code executing inside this component has distinct `primary`- -and `secondary`-scoped names for all `wasi:keyvalue/store` operations) while +and `secondary`-scoped names for all `local:demo/store` operations) while still providing the semantic information conveyed by the `interfacename` (so -that, e.g., hosts can implement both imports with a standard static host -`wasi:keyvalue/store` implementation that is dynamically parameterized by the +that, e.g., hosts can implement both imports with a single static host +`local:demo/store` implementation that is dynamically parameterized by the store names `"primary"` and `"secondary"`). 🏷️ The `external-id` attribute addresses the naming-expressivity gap left @@ -2736,16 +2736,16 @@ modules. E.g.: ) ``` Used together, `implements` and `external-id` allow a single component to, e.g., -import multiple `wasi:keyvalue/store`s using their platform's internal store +import multiple `local:demo/store`s using their platform's internal store naming scheme without needing to create a separate mapping or name-mangling scheme: ```wat (component (import "users" - (implements "wasi:keyvalue/store") (external-id "user-db-prod:region-a") + (implements "local:demo/store") (external-id "user-db-prod:region-a") (instance ...)) (import "catalog" - (implements "wasi:keyvalue/store") (external-id "catalog-db-prod:region-a") + (implements "local:demo/store") (external-id "catalog-db-prod:region-a") (instance ...)) ) ``` diff --git a/design/mvp/WIT.md b/design/mvp/WIT.md index 1f5ce56b3..1eb975c16 100644 --- a/design/mvp/WIT.md +++ b/design/mvp/WIT.md @@ -1469,18 +1469,18 @@ world my-component { or exported with a custom [plain name]. For example: ```wit world my-world { - import primary: wasi:keyvalue/store; - import secondary: wasi:keyvalue/store; - export my-handler: wasi:http/handler; + import primary: local:demo/store; + import secondary: local:demo/store; + export my-handler: local:demo/handler; } ``` Here, `primary` and `secondary` are two distinct imports that both have types -based on the `wasi:keyvalue/store` interface. The plain name of the import is +based on the `local:demo/store` interface. The plain name of the import is the `id` before the colon (e.g., `primary`), not the interface name. This -contrasts with `import wasi:keyvalue/store;` (without the `id :` prefix), which +contrasts with `import local:demo/store;` (without the `id :` prefix), which would create a single import using the full interface name -`wasi:keyvalue/store`. Similarly, the export `my-handler` has a type derived -from `wasi:http/handler` but uses the plain name `my-handler` instead of the +`local:demo/store`. Similarly, the export `my-handler` has a type derived +from `local:demo/handler` but uses the plain name `my-handler` instead of the full interface name, which is useful when a component wants to export the same interface multiple times or simply use a more descriptive name. @@ -1495,16 +1495,16 @@ world w { ``` Using both of these features together, a component can import a -`wasi:keyvalue/store` interface multiple times, using whatever platform-defined +`local:demo/store` interface multiple times, using whatever platform-defined naming scheme so that the component can be deployed directly to the platform without separate configuration or runtime errors: ```wit world my-world { @external-id("user-db-prod:region-a") - import users: wasi:keyvalue/store; + import users: local:demo/store; @external-id("catalog-db-prod:region-a") - import catalog: wasi:keyvalue/store; + import catalog: local:demo/store; } ```