Skip to content

Commit bb94567

Browse files
authored
Point to component model instead of host bindings (#3746)
* Point to component model instead of host bindings (fixes #3143) The original https://github.com/WebAssembly/host-bindings link in the doc is indeed redirected to https://github.com/WebAssembly/interface-types, which is the inactive one. There the "explainer" sheet says work moved to https://github.com/WebAssembly/component-model.
1 parent a5d2539 commit bb94567

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

guide/src/contributing/design/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ desired interface expressed in JS (classes, types, strings, etc) and the
2828
`foo_bg.wasm` module is simply used as an implementation detail (it was
2929
lightly modified from the original `foo.wasm` file).
3030

31-
As more features are stabilized in WebAssembly over time (like host bindings)
31+
As more features are stabilized in WebAssembly over time (like component model)
3232
the JS file is expected to get smaller and smaller. It's unlikely to ever
3333
disappear, but `wasm-bindgen` is designed to follow the WebAssembly spec and
3434
proposals closely to optimize JS/Rust as much as possible.
@@ -59,9 +59,9 @@ pub fn greet(name: &str) -> String {
5959
```
6060

6161
Additionally the design here with minimal intervention in Rust should allow us
62-
to easily take advantage of the upcoming [host bindings][host] proposal. Ideally
62+
to easily take advantage of the upcoming [component model][component-model] proposal. Ideally
6363
you'd simply upgrade `wasm-bindgen`-the-crate as well as your toolchain and
64-
you're immediately getting raw access to host bindings! (this is still a bit of
64+
you're immediately getting raw access to component model! (this is still a bit of
6565
a ways off though...)
6666

67-
[host]: https://github.com/WebAssembly/host-bindings
67+
[component-model]: https://github.com/WebAssembly/component-model

guide/src/introduction.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ ecosystem][rustwasm]. If you're not familiar already with `wasm-bindgen` it's
77
recommended to start by reading the [Game of Life tutorial][gol]. If you're
88
curious about `wasm-pack`, you can find that [documentation here][wasm-pack].
99

10-
The `wasm-bindgen` tool is sort of half polyfill for features like the [host
11-
bindings proposal][host] and half features for empowering high-level
10+
The `wasm-bindgen` tool is sort of half polyfill for features like the
11+
[component model proposal][component-model] and half features for empowering high-level
1212
interactions between JS and wasm-compiled code (currently mostly from Rust).
1313
More specifically this project allows JS/wasm to communicate with strings, JS
1414
objects, classes, etc, as opposed to purely integers and floats. Using
@@ -33,7 +33,7 @@ With the addition of [`wasm-pack`][wasm-pack] you can run the gamut from running
3333
the web locally, publishing it as part of a larger application, or even
3434
publishing Rust-compiled-to-WebAssembly on NPM!
3535

36-
[host]: https://github.com/WebAssembly/host-bindings
36+
[component-model]: https://github.com/WebAssembly/component-model
3737
[dom-ex]: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/dom
3838
[console-log]: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/console_log
3939
[perf-ex]: https://github.com/rustwasm/wasm-bindgen/tree/master/examples/performance

guide/src/reference/attributes/on-js-imports/final.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ prototype chain of an object. Note that `final` is not suitable for accessing
99
data descriptor properties of JS objects; to accomplish this, use the `structural`
1010
attribute.
1111

12-
[host-bindings]: https://github.com/WebAssembly/host-bindings
12+
[component-model]: https://github.com/WebAssembly/component-model
1313
[reference-types]: https://github.com/WebAssembly/reference-types
1414

1515
The `final` attribute is intended to be purely related to performance. It
1616
ideally has no user-visible effect, and `structural` imports (the default)
1717
should be able to transparently switch to `final` eventually.
1818

19-
The eventual performance aspect is that with the [host bindings
20-
proposal][host-bindings] then `wasm-bindgen` will need to generate far fewer JS
19+
The eventual performance aspect is that with the [component model
20+
proposal][component-model] then `wasm-bindgen` will need to generate far fewer JS
2121
function shims to import than it does today. For example, consider this import
2222
today:
2323

@@ -74,8 +74,8 @@ function with `getObject(arg0)` as the receiver.
7474

7575
But wait, there's still a JS function shim here even with `final`! That's true,
7676
and this is simply a fact of future WebAssembly proposals not being implemented
77-
yet. The semantics, though, match the future [host bindings
78-
proposal][host-bindings] because the method being called is determined exactly
77+
yet. The semantics, though, match the future [component model
78+
proposal][component-model] because the method being called is determined exactly
7979
once, and it's located on the prototype chain rather than being resolved at
8080
runtime when the function is called.
8181

@@ -106,14 +106,14 @@ export function __wbg_bar_a81456386e6b526f(arg0, arg1, arg2) {
106106
}
107107
```
108108

109-
Getting better! Next up we need the host bindings proposal. Note that the
109+
Getting better! Next up we need the component model proposal. Note that the
110110
proposal is undergoing some changes right now so it's tough to link to reference
111111
documentation, but it suffices to say that it'll empower us with at least two
112112
different features.
113113

114-
First, host bindings promises to provide the concept of "argument conversions".
114+
First, component model promises to provide the concept of "argument conversions".
115115
The `arg1` and `arg2` values here are actually a pointer and a length to a utf-8
116-
encoded string, and with host bindings we'll be able to annotate that this
116+
encoded string, and with component model we'll be able to annotate that this
117117
import should take those two arguments and convert them to a JS string (that is,
118118
the *host* should do this, the WebAssembly engine). Using that feature we can
119119
further trim this down to:
@@ -126,10 +126,10 @@ export function __wbg_bar_a81456386e6b526f(arg0, varg1) {
126126
}
127127
```
128128

129-
And finally, the second promise of the host bindings proposal is that we can
129+
And finally, the second promise of the component model proposal is that we can
130130
flag a function call to indicate the first argument is the `this` binding of the
131131
function call. Today the `this` value of all called imported functions is
132-
`undefined`, and this flag (configured with host bindings) will indicate the
132+
`undefined`, and this flag (configured with component model) will indicate the
133133
first argument here is actually the `this`.
134134

135135
With that in mind we can further transform this to:
@@ -138,8 +138,8 @@ With that in mind we can further transform this to:
138138
export const __wbg_bar_a81456386e6b526f = Foo.prototype.bar;
139139
```
140140

141-
and voila! We, with [reference types][reference-types] and [host
142-
bindings][host-bindings], now have no JS function shim at all necessary to call
141+
and voila! We, with [reference types][reference-types] and [component
142+
model][component-model], now have no JS function shim at all necessary to call
143143
the imported function. Additionally future wasm proposals to the ES module
144144
system may also mean that don't even need the `export const ...` here too.
145145

0 commit comments

Comments
 (0)