|
96 | 96 | `Deref<Target=JsValue>`. |
97 | 97 | * Otherwise, the *first* `extends` attribute is used to implement |
98 | 98 | `Deref<Target=ListedType>`. |
| 99 | +* (long term, currently require a breaking change) reject multiple `extends` |
| 100 | + attributes, requiring there's only one. |
99 | 101 |
|
100 | 102 | This means that `web-sys` may need to be updated to ensure that the immediate |
101 | 103 | superclass is listed first in `extends`. Manual bindings will continue to work |
@@ -236,9 +238,9 @@ classes are passed child classes which override methods**. |
236 | 238 |
|
237 | 239 | An easy solution to this problem is to simply use `structural` everywhere, so... |
238 | 240 | let's propose that! Consequently, this RFC proposes changing `#[wasm_bindgen]` |
239 | | -to act as if all bindings are labeled as `structural`. This will not be a |
240 | | -breaking change because the generated bindings will still have the same behavior |
241 | | -as before, they'll just handle subclassing correctly! |
| 241 | +to act as if all bindings are labeled as `structural`. While technically a |
| 242 | +breaking change it's believed that we don't have any usage which would actually |
| 243 | +run into the breakage here. |
242 | 244 |
|
243 | 245 | ### Adding `#[wasm_bindgen(final)]` |
244 | 246 |
|
@@ -276,7 +278,7 @@ As an example, today for `#[wasm_bindgen(method)] fn parent(this: &Parent);` we |
276 | 278 | generate JS that looks like: |
277 | 279 |
|
278 | 280 | ```rust |
279 | | -#[wasm_bindgen(method, structural)] |
| 281 | +#[wasm_bindgen(method)] |
280 | 282 | fn method(this: &Parent); |
281 | 283 | ``` |
282 | 284 |
|
@@ -309,17 +311,17 @@ first parameter as `this`, meaning we can transform this to: |
309 | 311 | export const __wasm_bindgen_Parent_method = Parent.prototype.method; |
310 | 312 | ``` |
311 | 313 |
|
312 | | -and *voila*, no JS shims necessary! With `structural` we'll still need a shim in |
313 | | -this future world: |
| 314 | +and *voila*, no JS function shims necessary! With `structural` we'll still need |
| 315 | +a function shim in this future world: |
314 | 316 |
|
315 | 317 | ```js |
316 | 318 | export const __wasm_bindgen_Parent_method = function() { this.method(); }; |
317 | 319 | ``` |
318 | 320 |
|
319 | 321 | Alright, with some of those basics out of the way, let's get back to |
320 | 322 | why-`final`-by-default. The promise of [host bindings] is that by eliminating |
321 | | -all these JS shims necessary we can be faster than we would otherwise be, |
322 | | -providing a feeling that `final` is faster than `structural`. This future, |
| 323 | +all these JS function shims necessary we can be faster than we would otherwise |
| 324 | +be, providing a feeling that `final` is faster than `structural`. This future, |
323 | 325 | however, relies on a number of unimplemented features in wasm engines today. |
324 | 326 | Let's consequently get an idea of what the performance looks like today! |
325 | 327 |
|
|
0 commit comments