You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
3.3 KiB

<h1 id="compatibility">Compatibility</h1>
<p>This section discussed Duktape compatibility with Ecmascript dialects,
extensions, frameworks, and test suites.</p>
<h2 id="compatibility-e5">Ecmascript E5 / E5.1</h2>
<p>The main compatibility goal of Duktape is to be Ecmascript E5/E5.1
compatible. Current level of compatibility should be quite high.</p>
<h2 id="compatibility-e3">Ecmascript E3</h2>
<p>There is no effort to maintain
<a href="http://www.mozilla.org/js/language/E262-3.pdf">Ecmascript E3</a>
compatibility, other than required by the E5/E5.1 specification.</p>
<h2 id="compatibility-coffeescript">CoffeeScript</h2>
<p><a href="http://coffeescript.org/">CoffeeScript</a> compiles to
JavaScript which should be compatible with Duktape. There are no known
compatibility issues.</p>
<p>Some CoffeeScript examples are included in the distributable. Simply
run <code>make</code> in <code>examples/coffee/</code>. For instance,
<code>hello.coffee</code>:</p>
<pre class="coffeescript-code">
print 'Hello world!'
print 'version: ' + Duktape.version
</pre>
<p>compiles to:</p>
<pre class="ecmascript-code">
(function() {
print('Hello world!');
print('version: ' + Duktape.version);
}).call(this);
</pre>
<h2 id="compatibility-underscorejs">Underscore.js</h2>
<p><a href="http://underscorejs.org/">Underscore.js</a> provides a lot of
useful utilities to plain Ecmascript. Duktape passes almost all of Underscore's
test cases, see
<a href="https://github.com/svaarala/duktape/blob/master/doc/underscore-status.txt">underscore-status.txt</a>
for current compatibility status.</p>
<h2 id="compatibility-test262">Test262</h2>
<p><a href="http://test262.ecmascript.org/">test262</a> is a test suite for
testing E5.1 compatibility, although it includes also tests outside of standard E5.1.
Duktape passes almost all of test262 cases, see
<a href="https://github.com/svaarala/duktape/blob/master/doc/test262-status.txt">test262-status.txt</a>
for current compatibility status.</p>
<h2 id="compatibility-asmjs">Asm.js</h2>
<p><a href="http://asmjs.org/spec/latest/">asm.js</a> is a
"strict subset of JavaScript that can be used as a low-level, efficient
target language for compilers". As a subset of JavaScript it should be
fully compatible with Duktape. However, Duktape has no specific support
for asm.js and won't optimize asm.js code. In fact, asm.js code will
generate unnecessary bytecode and execute slower than normal Ecmascript
code. The <code>"use asm"</code> directive specified by asm.js is ignored
by Duktape.</p>
<h2 id="compatibility-emscripten">Emscripten</h2>
<p><a href="https://github.com/kripken/emscripten">Emscripten</a> compiles
C/C++ into Javascript. Duktape is currently Emscripten compatible except
for:</p>
<ul>
<li>There is one non-standard RegExp in the Emscripten output, causing
a SyntaxError. This is easy to fix manually (see emscripen-status.txt).</li>
<li>Duktape doesn't yet have typed arrays, so give <code>emcc</code> the
option <code>-s USE_TYPED_ARRAYS=0</code> to disable their use.</li>
</ul>
<p>Performance is somewhat limited as Duktape is an interpreted engine.
Lack of typed array support also forces Emscripten to use a much slower model
for emulating application memory.</p>
<p>See
<a href="https://github.com/svaarala/duktape/blob/master/doc/emscripten-status.txt">emscripten-status.txt</a>
for current compatibility status.</p>