From c460d3d750fec2bc4b93cb9d39d67a87cdd2bae7 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 21 Jul 2025 13:12:55 -0700 Subject: [PATCH] why-component-model section: Include both file and wasm-tools output --- .../src/design/why-component-model.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/component-model/src/design/why-component-model.md b/component-model/src/design/why-component-model.md index f8946842..17ffeba3 100644 --- a/component-model/src/design/why-component-model.md +++ b/component-model/src/design/why-component-model.md @@ -26,6 +26,12 @@ Here's what the `file` command outputs for a sample `.wasm` file: $ file adder.wasm adder.wasm: WebAssembly (wasm) binary module version 0x1 (MVP) ``` +The file can also be inspected +using [the `wasm-tools` CLI](https://github.com/bytecodealliance/wasm-tools): +```console +$ wasm-tools print adder.wasm | head -1 +(module +``` A core module is a set of definitions. Kinds of definitions include: @@ -144,7 +150,18 @@ Conceptually, a component is a WebAssembly binary (which may or may not contain modules) that is restricted to interact only through the modules' imported and exported functions. -Components use a different binary format. +Components use a different binary format: +```console +$ file add.component.wasm +add.component.wasm: WebAssembly (wasm) binary module version 0x1000d +``` +Inspecting the file with the `wasm-tools` CLI +shows more clearly that it contains a component: +``` +$ wasm-tools print add.component.wasm | head -1 +(component +``` + Compared to core modules, components also use a richer mechanism by default for expressing the types of functions: _interfaces_.