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:
    Array
    Boolean
    Date
    Function
    Number
    Object
    RegExp
    String
    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
[email protected]

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

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to