archives

« Bugzilla Issues Index

#2495 — Consider reducing boilerplate around "new X(...argumentsList)"


From what I can tell, all built-in functions except for Object use the template:

---

new X ( ... argumentsList)

When X is called as part of a new expression, it initialises a newly created object.

Let F be the X function object on which the new operator was applied.
Let argumentsList be the argumentsList argument of the [[Construct]] internal method that was invoked by the new operator.
Return the result of Construct (F, argumentsList).

If X is implemented as an ECMAScript function object, its [[Construct]] internal method will perform the above steps.

---

This is kind of annoying to repeat, and see repeated, over and over. It could perhaps be factored out into a prelude of the sort "assume the following algorithm for `new` at all times, except when counter-specified." Kind of like property descriptors are assumed to be `{ enumerable: false, configurable: true, writable: true }`.


fixed in rev31 editor's draft

all gone...


In Rev31