2734RE: [jslint] Re: Warn on modifying Object.prototype
- Jan 7, 2012+1
From: email@example.com [mailto:firstname.lastname@example.org] On Behalf Of Michael Mikowski
Sent: Thursday, January 05, 2012 5:52 PM
Subject: Re: [jslint] Re: Warn on modifying Object.prototype
This seems like a valuable inclusion, IMO.
From: dcherman1 <daniel.c.herman@... <mailto:daniel.c.herman%40gmail.com> >
To: email@example.com <mailto:jslint_com%40yahoogroups.com>
Sent: Thursday, January 5, 2012 3:34 PM
Subject: [jslint] Re: Warn on modifying Object.prototype
It really depends on what you want the scope of JSLint to be. As I said in the original post, some libs ( again, specifically jQuery comes to mind ) that do not support working in an environment where Object.prototype has been modified, and those libs are extremely common. An option for this would eliminate a potential source of errors. That and I hadn't seen a discussion for this previously.
If the scope of JSLint is to be pure JS and nothing but, then I'd agree that this shouldn't be implemented if you think there are currently valid reasons to extend Object.prototype ( out of curiosity, what were you thinking specifically? Shims/Polyfills? ).
With all of that said, this eventually won't be as useful once we have Object.defineProperty in most browsers in the wild, but who knows when that's going to be.
--- In firstname.lastname@example.org <mailto:jslint_com%40yahoogroups.com> , "douglascrockford" <douglas@...> wrote:
> --- In email@example.com <mailto:jslint_com%40yahoogroups.com> , "dcherman1" <daniel.c.herman@> wrote:
> > I don't know what your views are on modifying Object.prototype, but I'm sure you've heard all the arguments about why it's a terrible idea. Some very common libs ( jQuery comes to mind ) have stated they they don't support working in an environment where it's been modified.
> > Since I didn't see any other requests for this, I'm suggesting another option to forbid modifying Object.prototype. Thoughts?
> There are times when modifying Object.prototype is a smart thing to do. But it is usually a bad thing for applications to do. And I think that assuming that no one else will ever do it is a foolish thing to do.
> Is this a useful check you are proposing, or is it theoretical?
[Non-text portions of this message have been removed]
- << Previous post in topic