This issue proposes that WASI adopt the Component Model's map type (gated as 🗺️ in the Component Model's gated features), following the process described in CONTRIBUTING.md § Adopting Component Model features.
Feature
The 🗺️ gate covers the map<K, V> WIT type (WIT.md § Types). A map is semantically equivalent to a list of key–value pairs — it shares the same canonical ABI representation as list<tuple<K, V>> — but is intended to be represented by bindings generators as the source language's native mapping type (associative array, hash table, dictionary), with last-key-wins semantics for duplicate keys. Key types are restricted to bool, integers, char, and string.
interface config {
get-all: func() -> map<string, string>;
}
Because the ABI representation is unchanged from list<tuple<K, V>>, the feature is primarily a WIT-level and bindings-level improvement: it lets interfaces state intent (this is a keyed collection) and gives component authors idiomatic bindings without any new runtime machinery.
Stability
Iteration and feedback
Implementation experience preceded the spec merge by several months, and the feedback it produced was incorporated into the final design:
wit-bindgen-core (crates/core) has full ABI support with dedicated MapLower/MapLift/IterMapKey/IterMapValue/GuestDeallocateMap instructions in abi.rs, lowered with the same linear-memory layout as list<tuple<K, V>>.
Per-language status in wit-bindgen
| Language |
Codegen |
Runtime round-trip test |
Landed |
| Rust |
✅ (configurable map_type, e.g. std::collections::HashMap) |
✅ |
#1562 (core PR itself touched Rust) |
| Go |
✅ |
✅ |
#1583 |
| MoonBit |
✅ |
✅ |
#1584 |
| C |
✅ |
✅ |
#1611 |
| C# |
✅ |
⏳ draft PR open |
#1603 (codegen), #1640 (runtime tests, open/draft) |
| C++ |
✅ |
❌ none yet |
#1590 |
| Markdown (docs gen) |
✅ (type rendering only) |
n/a |
#1562 |
Relevant PRs (all by Yordis unless noted)
- #1562 — "Add map support" (merged 2026-04-09) — foundational: core ABI +
Rust/C/C++/C#/Go/MoonBit/Markdown scaffolding, plus tests/codegen/map.wit
and tests/runtime/map/*
- #1583 — feat(go): add map type support (merged 2026-04-10)
- #1584 — feat(moonbit): add map type support (merged 2026-04-14)
- #1603 — feat(csharp): add map type support (merged 2026-05-05)
- #1611 — feat(c): add map type support (merged 2026-06-02)
- #1590 — feat(cpp): add map type support (merged 2026-06-29)
- #1640 — test(csharp): cover map runtime exports (open, draft) —
closes the gap where C# map support is only exercised by generated-bindings
inspection, not actual runtime composition/roundtrip
WASI APIs that would depend on it
Several WASI proposals model keyed collections today as list<tuple<string, T>> and would use map in newly added or newly stabilized APIs:
Adopting 🗺️ does not change any already-released wasi:* API: existing stable signatures keep their current types. It makes map available to stable (@since-gated) APIs from the adopting release onward, and part of the baseline that runtimes and toolchains must support for that release.
Requested action
Per CONTRIBUTING.md § Adopting Component Model features, we believe the stability criteria are met: the design is complete, and the feature has been through a phase of iteration and feedback across the toolchain implementations that consume WIT.
We therefore aim to add a vote to an upcoming WASI Subgroup meeting agenda to adopt the Component Model map type (🗺️) for inclusion in the next WASI 0.3.x release. Once adopted:
This issue proposes that WASI adopt the Component Model's
maptype (gated as 🗺️ in the Component Model's gated features), following the process described in CONTRIBUTING.md § Adopting Component Model features.Feature
The 🗺️ gate covers the
map<K, V>WIT type (WIT.md § Types). Amapis semantically equivalent to a list of key–value pairs — it shares the same canonical ABI representation aslist<tuple<K, V>>— but is intended to be represented by bindings generators as the source language's native mapping type (associative array, hash table, dictionary), with last-key-wins semantics for duplicate keys. Key types are restricted tobool, integers,char, andstring.Because the ABI representation is unchanged from
list<tuple<K, V>>, the feature is primarily a WIT-level and bindings-level improvement: it lets interfaces state intent (this is a keyed collection) and gives component authors idiomatic bindings without any new runtime machinery.Stability
Iteration and feedback
Implementation experience preceded the spec merge by several months, and the feedback it produced was incorporated into the final design:
maptype support in feat(wit): add map type support bytecodealliance/wasm-tools#2356 (merged 2025-12-22, roughly five months before the spec PR merged); compatibility feedback incorporated in Escapemapwhen printing WITs bytecodealliance/wasm-tools#2424 (escapingmapwhen printing WITs, so existing packages usingmapas an identifier keep round-tripping).bool, integers,char,string) and the duplicate-key (last-key-wins) semantics were settled through review on the spec and implementation PRs.wit-bindgen-core(crates/core) has full ABI support with dedicatedMapLower/MapLift/IterMapKey/IterMapValue/GuestDeallocateMapinstructions inabi.rs, lowered with the same linear-memory layout aslist<tuple<K, V>>.Per-language status in wit-bindgen
map_type, e.g.std::collections::HashMap)Relevant PRs (all by Yordis unless noted)
Rust/C/C++/C#/Go/MoonBit/Markdown scaffolding, plus
tests/codegen/map.witand
tests/runtime/map/*closes the gap where C# map support is only exercised by generated-bindings
inspection, not actual runtime composition/roundtrip
WASI APIs that would depend on it
Several WASI proposals model keyed collections today as
list<tuple<string, T>>and would usemapin newly added or newly stabilized APIs:get-allAdopting 🗺️ does not change any already-released
wasi:*API: existing stable signatures keep their current types. It makesmapavailable to stable (@since-gated) APIs from the adopting release onward, and part of the baseline that runtimes and toolchains must support for that release.Requested action
Per CONTRIBUTING.md § Adopting Component Model features, we believe the stability criteria are met: the design is complete, and the feature has been through a phase of iteration and feedback across the toolchain implementations that consume WIT.
We therefore aim to add a vote to an upcoming WASI Subgroup meeting agenda to adopt the Component Model
maptype (🗺️) for inclusion in the next WASI 0.3.x release. Once adopted:@since-gated) WASI APIs in the next release may depend on the feature.