Expand description
The standard library: the globals a script reaches without an import.
The set installed here is the one milestone M4 targets — Object, Function,
Array, String, Number, Boolean, Math, JSON and the error classes —
which is what a script needs before it can do anything useful at all.
Two conventions run through every module:
- A method is a native function stored on a prototype, and it receives
thisexactly as a script method would. Nothing is special-cased by call site. - Argument checks throw the same error class the reference does, because the
test suite asserts on
instanceofand one.name.
Functions§
- arg
- Argument
index, orundefinedwhen it was not passed. - arg_
int_ or - Argument
indexas an integer, orNonewhen it isundefined— the shape optional numeric arguments need. - arg_
number - Argument
indexas a number, with theundefined-is-NaNrule ofToNumber. - define_
method - Define
nameontargetas a non-enumerable method, the way every built-in method is defined. - has_arg
- Whether argument
indexwas actually passed. - install
- Install the standard library on
interp’s realm. - method
- A native function object, ready to be stored as a value.
- this_
object - The
thisof a method call, as an object. - this_
string - The text a string method operates on, whether
thisis a primitive or a box.