Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

JavaScript

ShockScript gets too many roots from JavaScript, although more particularly linked to a previously abandoned version, JavaScript 2 (or ECMAScript 4th).

Map data type

The ShockScript’s Map data type differs fundamentally from JavaScript’s Map in that key-value pairs are accessed more naturally. ShockScript resolves the ambiguity between pairs and the prototype by differentiating property read and call.

m.x = 10
m.length()

Note: For a dynamic user class, it may very rarely be necessary to access a fixed variable rather than an arbitrary key-value pair; for that, the user may use a fixed expression as in <?fixed={o.x}?>. This is mostly useless since ShockScript’s lexical resolution ignores dynamic names and most dynamic user classes access their internal variables from the same class block.

Variable shadowing

In ShockScript the following is valid in an activation:

var m:* = complex.manager;

var m = Manager(m);

“not” keyword

not may be used to negate in or is operators:

e not in a
v is not T

“this” binding

The this binding is fixed and present only in instance methods.

  • Methods like [object Function].apply() do not take a this binding: only the parameters.
  • Instance methods are bound.