BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News WebAssembly Browser Preview Asks Community for Feedback

WebAssembly Browser Preview Asks Community for Feedback

Leia em Português

This item in japanese

The development of WebAssembly has reached the browser preview stage, an important milestone in the journey towards standardization.

In Chrome, Edge, and Firefox, users can enable a preview version of WebAssembly that uses a "release candidate" of the binary format the WebAssembly Community Group has been working on. In addition, a developer's guide has been prepared that walks through the steps of creating a WebAssembly program in C, compiling it, and serving up the results in the browser.

Unlike the previous experimental support preview, this browser preview is cross-browser compatible and stable. The browser vendors are actively encouraging use of this preview in order to gather feedback.

On the Microsoft Edge browser preview announcement, Program Manager Limin Zhu showed off an example of the compiled results:

In the example, the C++ factorial function

int factorial(int n)
{
if (n == 0)
return 1;
else
return n * factorial(n-1);
}

compiles to WebAssembly like this:

binary   | text


20 00    | get_local 0
42 00    | i64.const 0
51       | i64.eq
04 7e    | if i64
42 01    |   i64.const 1
05       | else
20 00    |   get_local 0
20 00    |   get_local 0
42 01    |   i64.const 1
7d       |   i64.sub
10 00    |   call 0
7e       |   i64.mul
0b       | end

Despite calling the binary format a release candidate, it is not ready for production usage and it will change. On the WebAssembly Roadmap, developers are forewarned:

Developers should be aware that between the Browser Preview and public launch of WebAssembly, there will be at least one breaking change which will require developers to update their toolchain and binaries.

This phrase of the project will end sometime in Q1 of 2017 after which a draft specification will be prepared. When that's done, vendors will be able to turn the feature on by default, without hiding it behind a feature flag. Luke Wagner of Mozilla says that if this schedule follows as planned, Firefox 52 in March 2017 will have the feature on by default.

Conspicuously absent from this list of browser vendors is Apple and its Safari browser, built on WebKit. While the company has been silent, they are working on it. Brendan Eich says Apple's progress "is all speculation until they ship" but that "they're (Apple) keen on WebAssembly and everything looks as on track as it can be." Ben Titzer, the Google representative to and co-chair of the WebAssembly Community Group says that Apple does "send representatives to the (rare) in-person summits that we've held" and that "it does seem that they have started working on an implementation, but we are careful not to put words into their mouths or read too much into that."

Rate this Article

Adoption
Style

Educational Content

BT