From 84f1387ac28536d414dc03cd994f1187b8b05e0e Mon Sep 17 00:00:00 2001 From: Alex Crichton <alex@alexcrichton.com> Date: Tue, 22 Apr 2025 15:06:59 -0700 Subject: [PATCH] Document fixed-size-lists must be non-empty Currently the component model and WIT generally avoid zero-sized types since they're not always handled well in all languages. Given the niche use case of a zero-sized list add a validation rule that fixed-size-lists are non-zero in length. Closes #503 --- design/mvp/Binary.md | 2 ++ design/mvp/Explainer.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/design/mvp/Binary.md b/design/mvp/Binary.md index 64cbe3bd..2f6547b1 100644 --- a/design/mvp/Binary.md +++ b/design/mvp/Binary.md @@ -275,6 +275,8 @@ Notes: to match the preceding `sort`. * (The `0x00` immediate of `case` may be reinterpreted in the future as the `none` case of an optional immediate.) +* 🔧 for fixed-sized lists the length of the list must be larger than 0 to pass + validation. ## Canonical Definitions diff --git a/design/mvp/Explainer.md b/design/mvp/Explainer.md index 77602bc5..9a8330ea 100644 --- a/design/mvp/Explainer.md +++ b/design/mvp/Explainer.md @@ -672,7 +672,7 @@ and sequencing contained values. 🔧 When the optional `<u32>` immediate of the `list` type constructor is present, the list has a fixed length and the representation of the list in memory is -specialized to this length. +specialized to this length. Note that the fixed length must be larger than 0. ##### Handle types