Custom directives

Ecmascript E5/E5.1 employs a directive prologue to allow version or implementation specific features be activated. The standard only provides one such directive, "use strict", while asm.js uses "use asm". Duktape custom directives are discussed in this section.

use duk notail

The use duk notail directive indicates that the function should never be tail called. Tail calls affect the call stack so they are visible in stack traces (usually harmless) and affect functions which inspect the call stack using e.g. Duktape.act(). This directive may be useful in special cases to ensure call stack has a known shape. Example:

function noTailCall() {
    'use duk notail';

    // ...
}

Native functions are never tailcalled, so a corresponding declaration is not necessary for them.