From 916bd10e6ed49df5b022d49d5e87c3c525613ff7 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 21 Jul 2015 12:06:47 -1000 Subject: Address more comments --- Modules.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'Modules.md') diff --git a/Modules.md b/Modules.md index fe881fb..dc5a897 100644 --- a/Modules.md +++ b/Modules.md @@ -47,11 +47,12 @@ arbitrary host environment functionality to WebAssembly code, similar to a native `syscall`. For example, a shell environment could define a builtin `stdio` module with an export `puts`. -In C/C++, an undefined `extern` declaration could be compiled to an import and -C/C++ calls to this `extern` would then be compiled to calls to this import. This -is one way low-level C/C++ libraries could call out of WebAssembly in order to -implement portable source-level interfaces (e.g., POSIX, OpenGL or SDL) in -terms of host-specific functionality. +In C/C++, an undefined `extern` declaration (perhaps only when given the +magic `__attribute__` or declared in a separate list of imports) could be +compiled to an import and C/C++ calls to this `extern` would then be compiled +to calls to this import. This is one way low-level C/C++ libraries could call +out of WebAssembly in order to implement portable source-level interfaces +(e.g., POSIX, OpenGL or SDL) in terms of host-specific functionality. ### Integration with ES6 modules @@ -83,7 +84,11 @@ if they were `import` statements of an ES6 module. If an ES6 module `import`ed a WebAssembly module, the WebAssembly module's exports would be linked as if they were the exports of an ES6 module. Once parsing and linking phases were complete, a WebAssembly module would have its `_start` function called in -place of executing the ES6 module top-level script. +place of executing the ES6 module top-level script. By default, multiple +loads of the same module URL (in the same realm) reuse the same singleton +module instance. It may be worthwhile in the future to consider extensions to +allow applications to load/compile/link a module once and instantiate multiple +times (each with a separate heap and global state). This integration strategy should allow WebAssembly modules to be fairly interchangeable with ES6 modules (ignoring -- cgit v1.2.3