[jslint] Re: Arguments class
- --- In firstname.lastname@example.org, Randy Cox <rcox@...> wrote:
>I was anticipating that Object.beget was going to be added to the language, and it was, but the committee changed the name to Object.create, which I corrected in the second printing. Similarly, String.trim is now in the language.
> > I recommend that you not hang stuff on Array or any of the other global
> objects. The Prototype library
> > does that, creating interoperability problems.
> How can this recommendation coexist with all of the examples of augmented
> objects that you list in the Good Parts book? Object.beget,
> Function.method, Function.inherits, Number.integer, String.trim,
> Array.reduce, etc. Where do you draw the line between acceptable and
> unacceptable augmentation?
Adding things to prototypes can be beneficial but is risky. We have been doing this long enough now that we know the risks.
Adding things directly to system objects like Array is not beneficial, and can interfere with future developments. ES5 adds new methods to Object because it was likely that some breakage would occur if they were added to Object.prototype, increasing the sorts of hazards that we see with hasOwnProperty.