Deno: Bring back .wasm imports

Created on 19 May 2020  路  6Comments  路  Source: denoland/deno

It was removed in #5135
Potentially this should be behind the --unstable flag?

cc @bartlomieju

cli feat

Most helpful comment

Biggest problem with the non-standard feature for imports is that what if this becomes standard which is incompatible how it was implemented in Deno?

Then there is possibility it will break the code depending on the feature, and there is no good way to highlight the error lines. To mitigate that risk there could be alternate syntax, e.g.:

unstable import * as M from "./mymodule.wasm"

or even

// @deno-import
import * as M from "./mymodule.wasm"

(In example below the Deno would not allow the import at all if the @deno-import is not there)

If the wasm module imports become a standard, then it would be as simple as removing the unstable modifier (or additionally change it because it can't be known if it works with the standard that doesn't exist).

I hope I'm making sense.

All 6 comments

The wasm esm integration spec is currently stage 2. Before we add this feature (which we should) the implementors should familiarize themselves with this in-progress specification:
https://github.com/WebAssembly/esm-integration/tree/master/proposals/esm-integration
and particularly the examples:
https://github.com/WebAssembly/esm-integration/blob/master/proposals/esm-integration/EXAMPLES.md

Wasn't the only thing blocking the release of this support for "top-level await," which Deno seems to have already, putting it ahead of all of the major browsers? Doesn't the current support for top-level await make Deno non-web compatible?

@00ff0000red Top level await is implemented by V8, not Deno. And that landed in browsers just recently, so there's not even reason to argue about it

The module implementation however IS specific to the runtime, so an implementation of WASM imports that gets rushed might break the Deno phylosophy

Top level await is implemented by V8, not Deno.

It is in Deno and has been for a long time. 馃槙

There is nothing really holding this back other than the fact that getting the semantics to line up to something that seems stalled in the stands process is a challenge/risk.

@kitsonk I ment to say that
TLA -> Engine
WASM imports -> Runtime

Biggest problem with the non-standard feature for imports is that what if this becomes standard which is incompatible how it was implemented in Deno?

Then there is possibility it will break the code depending on the feature, and there is no good way to highlight the error lines. To mitigate that risk there could be alternate syntax, e.g.:

unstable import * as M from "./mymodule.wasm"

or even

// @deno-import
import * as M from "./mymodule.wasm"

(In example below the Deno would not allow the import at all if the @deno-import is not there)

If the wasm module imports become a standard, then it would be as simple as removing the unstable modifier (or additionally change it because it can't be known if it works with the standard that doesn't exist).

I hope I'm making sense.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ry picture ry  路  3Comments

CruxCv picture CruxCv  路  3Comments

ry picture ry  路  3Comments

sh7dm picture sh7dm  路  3Comments

motss picture motss  路  3Comments