What prevents built-in constructors from being extended?

Axel Rauschmayer axel at rauschma.de
Fri Dec 2 23:27:23 PST 2011

I’m still trying to understand why some of the built-in constructors can’t be extended. The following describes my current understanding. If you would, please let me know where/if I’m wrong.

- The following built-in constructors can’t be easily extended:
    Error and sub-constructors
- Reason (Array): Array instances need special support to update the length property depending on what elements are added. But that specialness should go away with Allen’s proposal for overriding element access via [].

- Reason (all): The constructors can’t be invoked as functions while handing in `this` – be it that they create new instances, be it that they do something else – they can’t be made to add properties to an existing instance. This prevents the pattern SuperConstructor.call(this, arg1, arg2, ...) from working.

Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

More information about the es-discuss mailing list