Loading ...
Sorry, an error occurred while loading the content.

Re: Warn on modifying Object.prototype

Expand Messages
  • douglascrockford
    ... 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
    Message 1 of 5 , Jan 5, 2012
    • 0 Attachment
      --- In jslint_com@yahoogroups.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?
    • dcherman1
      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
      Message 2 of 5 , Jan 5, 2012
      • 0 Attachment
        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 jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:
        >
        > --- In jslint_com@yahoogroups.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?
        >
      • Michael Mikowski
        This seems like a valuable inclusion, IMO. ________________________________ From: dcherman1 To: jslint_com@yahoogroups.com Sent:
        Message 3 of 5 , Jan 5, 2012
        • 0 Attachment
          This seems like a valuable inclusion, IMO.


          ________________________________
          From: dcherman1 <daniel.c.herman@...>
          To: jslint_com@yahoogroups.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 jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:
          >
          > --- In jslint_com@yahoogroups.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]
        • Rob Richardson
          +1 ... From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On Behalf Of Michael Mikowski Sent: Thursday, January 05, 2012 5:52 PM To:
          Message 4 of 5 , Jan 7, 2012
          • 0 Attachment
            +1

            -----Original Message-----
            From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On Behalf Of Michael Mikowski
            Sent: Thursday, January 05, 2012 5:52 PM
            To: jslint_com@yahoogroups.com
            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: jslint_com@yahoogroups.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 jslint_com@yahoogroups.com <mailto:jslint_com%40yahoogroups.com> , "douglascrockford" <douglas@...> wrote:
            >
            > --- In jslint_com@yahoogroups.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]
          Your message has been successfully submitted and would be delivered to recipients shortly.