April 2002 Draft
Friday, January 11, 2002
Pragmas allow a script writer to select program modes and options. Pragmas are lexically scoped and their effect does not extend past the end of the enclosing block, directive group, or substatement group.
use is followed by one or more PragmaItems, each
of which consists of an identifier, an optional argument, and an optional
The pragma identifiers below are currently defined. Implementations may define additional identifiers that have meaning as pragmas.
|Error if version n of ECMAScript is not supported; otherwise recommends but does not require that the implementation only support ECMAScript version n features.
|Non-strict mode (default)
|Converting an out-of-range integer to an integral machine type wraps around
|Converting an out-of-range integer to an integral machine type causes an error (default)
The pragma takes effect starting with the directive after the pragma and continues either until the end of the enclosing
block or statement group or until overridden by another pragma in the same block or statement group, whichever comes first.
If a pragma references the same identifier several times, the last reference takes precedence. The semicolon insertion rule
changes implied by the
strict pragma apply to the semicolon, if any, ending the
use directive that
contains that pragma.
If an implementation does not recognize a pragma identifier, then if the PragmaItem
ends with a
? then that PragmaItem is ignored without evaluating
its ParenExpressions; if the PragmaItem
does not end with a
? then an error occurs.
The opposite of strict mode is nonstrict mode, which is the default. A program can readily mix strict and nonstrict portions.
Strict mode has the following effects:
function declarations without attributes or types are initialized
at the beginning of a scope.
An implementation does not have to implement strict mode; however, implementations are encouraged to do so.
See also the rationale.
Last modified Friday, January 11, 2002