From 72da520f6fb4af954e4dedee6dfb8941a8694d45 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Wed, 25 Nov 2026 11:39:28 -0600 Subject: [PATCH] Reorganizations and JS reference updates Just a bunch of drive-by updates made as part of union/overload work. --- README.md | 2 +- design/mvp/Binary.md | 8 +- design/mvp/JS-Reference.md | 15 +-- design/mvp/Text.md | 222 +++++++++++++++++++++---------------- design/mvp/WIT.md | 12 +- 5 files changed, 144 insertions(+), 115 deletions(-) diff --git a/README.md b/README.md index 8cb693f2..4a49a8ea 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ The current WASI Developer Preview releases are: well as new [ABI] built-in functions (additions are marked by the πŸ”€ emoji throughout the repo). * 0.3.1: adds the `map` type (πŸ—ΊοΈ) and the `implements` and `external-id` - annotations (🏷️). + attributes (🏷️). Subsequent WASI Developer Preview releases will include other emoji-[gated features] such as cooperative threads (🧡). diff --git a/design/mvp/Binary.md b/design/mvp/Binary.md index e196d479..ad68d477 100644 --- a/design/mvp/Binary.md +++ b/design/mvp/Binary.md @@ -11,8 +11,8 @@ rules, but rather merge the minimal need-to-know elements of both, with just enough detail to create a prototype. A complete definition of the binary format and validation will be present in the [formal specification](../../spec/). -See [Gated Features](Text.md#gated-features) for an explanation of emoji -annotations like πŸͺ™ and πŸ”§. +See [Gated Features](Text.md#gated-features) for an explanation of emoji like +πŸͺ™ and πŸ”§. ## Component Definitions @@ -434,8 +434,8 @@ Notes: `[method]`, `[static]`, πŸ“‘ `[get]`, or πŸ“‘ `[set]` only occur on `func` imports or exports. * Validation requires that, for `plainname`s annotated with `[constructor]`, - `[method]`, or `[static]`, the first `label` matches the `plainname` of a - preceding `resource` import or export, respectively, in the same scope + `[method]`, or `[static]`, the resource name `label` matches the `plainname` + of a preceding `resource` import or export, respectively, in the same scope (component, component type or instance type). * 🏷️ Validation requires that `implements`-annotated imports or exports are `instance`-typed and have a `plainname` name. diff --git a/design/mvp/JS-Reference.md b/design/mvp/JS-Reference.md index a092847e..0dc08baf 100644 --- a/design/mvp/JS-Reference.md +++ b/design/mvp/JS-Reference.md @@ -252,7 +252,7 @@ Dispatch on `componentValType`: - `flags "L"+` β†’ `ToJSValueFlags`(|componentValue|, the labels). - `enum "L"+` β†’ String, the label verbatim. - `option` not nested within another `option` β†’ **undefined** for `none`, else `ToJSValue`(the payload, T). -- `variant`, and nested `option`, and `result` outside return position β†’ `ToJSValueVariant`(|componentValue|, the cases). In return position a `result` is unwrapped instead, into a return value or a thrown `ComponentError` (see [Read the imports](#read-the-imports-object) and [Create the exports object](#create-the-exports-object)). +- `variant`, and nested `option`, and `result` outside return position β†’ `ToJSValueVariant`(|componentValue|). In return position a `result` is unwrapped instead, into a return value or a thrown `ComponentError` (see [Read the imports](#read-the-imports-object) and [Create the exports object](#create-the-exports-object)). - `map` β†’ `ToJSValueMap`(|componentValue|, K, V). - `own` / `borrow` β†’ See [Resource types](#resource-types). - `future` β†’ a Promise (TODO). @@ -293,11 +293,12 @@ The `scalar typed array class` is given by: 1. Perform `CreateDataPropertyOrThrow`(|object|, `CamelCase`(L), |value|'s `L` bit as a Boolean). 1. Return |object|. -`ToJSValueVariant(value, cases)`: +`ToJSValueVariant(value)`: +1. Let |case| be the current case of the variant |value|. 1. Let |object| be `OrdinaryObjectCreate`(**null**). -1. Perform `CreateDataPropertyOrThrow`(|object|, "kind", `CaseLabelOf`(|value|, |cases|)). -1. If that case has a payload of type T: - 1. Perform `CreateDataPropertyOrThrow`(|object|, "value", `ToJSValue`(`PayloadOf`(|value|), T)). +1. Perform `CreateDataPropertyOrThrow`(|object|, "kind", the label of |case|). +1. If |case| has a payload of type |T|: + 1. Perform `CreateDataPropertyOrThrow`(|object|, "value", `ToJSValue`(the payload of |value|, |T|)). 1. Return |object|. This operation is used for variant, and also cases in the above table where we can't specialize the behavior of `option` and `result`. @@ -1064,8 +1065,8 @@ To `create the exports object` given an [instance record](#instance-records) |in 1. Let |value| be ? `create the exports object` given |instance| and the exports of the exported instance. 1. **component**: 1. Let |value| be a new `Component` whose [[Component]] is |export|.Component. - 1. Perform `CreateDataPropertyOrThrow`(|exportsObject|, |key|, |value|). -1. Perform `SetIntegrityLevel`(|exportsObject|, "frozen"). + 1. Perform ? `CreateDataPropertyOrThrow`(|exportsObject|, |key|, |value|). +1. Perform ? `SetIntegrityLevel`(|exportsObject|, "frozen"). 1. Return |exportsObject|. TODO: We need a JSName for members that hit the `reserved class members` list. It needs to concatenate the resource name with the method name somehow. diff --git a/design/mvp/Text.md b/design/mvp/Text.md index 40106158..66656a08 100644 --- a/design/mvp/Text.md +++ b/design/mvp/Text.md @@ -18,7 +18,7 @@ Developer Preview release, as recorded in the [top-level readme](../../README.md and thus are not open to breaking changes before the final 1.0 release: * πŸ”€: native concurrency support with `async`, `stream` and `future` * πŸ—ΊοΈ: the `map` type -* 🏷️: `implements` and `external-id` annotations for imports/exports +* 🏷️: `implements` and `external-id` attributes for imports/exports All other features are in various stages of implementation, are not enabled by default, may have breaking changes, and, after a suitable [WASI] SG vote, may be @@ -2736,8 +2736,10 @@ plainname ::=