Closed littledan closed 5 years ago
I think that a mutable Object is a better term, whereas live binding would implit a direct memory access?
The WebAssembly spec doesn't mention "live binding", we should avoid introducing it here.
But specifying mutable Object
will give an impression of an object is mutable in two ways (both via JS and WASM). I think it is a thin line here
Well, for WebAssembly.Memory
or WebAssembly.Global
(mutable) that's how they work.
yeah, I agree, but that does not include everything right?
OK, sounds like we should avoid calling exported functions mutable objects. Anything else?
I think yes. since WebAssembly.Tables
are mutable in JS world.
This thing is that from a JS perceptive (unless it's readonly) a WebAssembly func (HostFunc) is a mutable object, right? You can perform mutation; add props etc.
I think we should just avoid the term "live binding" and call the communication surface: API.
Otherwise it seems to me that location.href
should be called "live binding" too.
Yes, it's true, and the Wasm/JS API guarantees that the host functions are shared when being re-exported multiple times.
@xtuc does it means that I can override the HostFunc
in JS with something else and it will be updated is it?
that the host functions are shared
Yeah, they are shared. Are they mutable?
Yes, they are ordinary mutable JS objects.
I originally thought "live binding" referred to a mutable variable storage, which could be exported, and then overwriting the variable on one end would affect the live binding on the other end.
The README in this repository, and under #13, seems to use "live binding" to mean something else: when wasm exports something (e.g., a Global, Memory, or Table) which is somehow mutable, then the binding is "live" in the sense that, when that object is mutated, it's reflected in the exported version. This usage was initially surprising to me; I would've thought of this as a kind of snapshot (just a shallow one, of a mutable object)
I'd suggest that, in this proposal, we either clarify that we're using this broader sense of "live binding" (could be just a couple sentences), or avoid the term.