Skip to content

Nit: What should we use the term "live binding" for? #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
littledan opened this issue Oct 15, 2018 · 11 comments
Closed

Nit: What should we use the term "live binding" for? #19

littledan opened this issue Oct 15, 2018 · 11 comments

Comments

@littledan
Copy link
Collaborator

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.

@xtuc
Copy link
Contributor

xtuc commented Oct 16, 2018

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.

@sendilkumarn
Copy link

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

@xtuc
Copy link
Contributor

xtuc commented Oct 16, 2018

Well, for WebAssembly.Memory or WebAssembly.Global (mutable) that's how they work.

@sendilkumarn
Copy link

yeah, I agree, but that does not include everything right?

@littledan
Copy link
Collaborator Author

OK, sounds like we should avoid calling exported functions mutable objects. Anything else?

@sendilkumarn
Copy link

I think yes. since WebAssembly.Tables are mutable in JS world.

@xtuc
Copy link
Contributor

xtuc commented Oct 16, 2018

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.

@littledan
Copy link
Collaborator Author

Yes, it's true, and the Wasm/JS API guarantees that the host functions are shared when being re-exported multiple times.

@sendilkumarn
Copy link

@xtuc does it means that I can override the HostFunc in JS with something else and it will be updated is it?

@sendilkumarn
Copy link

that the host functions are shared

Yeah, they are shared. Are they mutable?

@littledan
Copy link
Collaborator Author

Yes, they are ordinary mutable JS objects.

xtuc pushed a commit to xtuc/esm-integration that referenced this issue Aug 13, 2019
- Initialize Wasm exports in TDZ; closes WebAssembly#18
- Document motivation for no circular modules and circular imports
  of functions as a follow-on; closes WebAssembly#17
- Avoid use of the term "live binding"; closes WebAssembly#19
- Permit imports of Numbers as constant globals; closes WebAssembly#16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants