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

RE: [jslint] use strict

Expand Messages
  • Rob Richardson
    use strict identifies you re opting into the ECMAScript 5 mode of the same name. Rob ... From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com]
    Message 1 of 7 , Nov 2, 2010
    • 0 Attachment
      "use strict" identifies you're opting into the ECMAScript 5 mode of the same
      name.

      Rob


      -----Original Message-----
      From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
      Behalf Of James
      Sent: Monday, November 01, 2010 1:25 PM
      To: jslint_com@yahoogroups.com
      Subject: [jslint] use strict

      I run all my JavaScript through a strict version of JSLint, run it with a
      careful eye toward any warning messages found in Firebug, and I think my
      code is quite good. What advantage is there to adding "use strict" to the
      top of my code? Will it catch errors I'm not already catching? Will it
      actually run faster or parse better in any browsers?

      Thanks,
      James
    • James
      Yes, I understand. But why should I? If I always drive the speed limit, why should I put a speed regulator on my car? There may very well be a reason, I
      Message 2 of 7 , Nov 3, 2010
      • 0 Attachment
        Yes, I understand. But why should I? If I always drive the speed limit, why should I put a speed regulator on my car? There may very well be a reason, I just want to know what advantage there is for me.

        --- In jslint_com@yahoogroups.com, "Rob Richardson" <erobrich@...> wrote:
        >
        > "use strict" identifies you're opting into the ECMAScript 5 mode of the same
        > name.
        >
        > Rob
      • Luke Page
        ECMAScript 5 may be (negligably) faster, but the main benefit you get is in using/preparing to use a language that is more sane and developed and is the future
        Message 3 of 7 , Nov 3, 2010
        • 0 Attachment
          ECMAScript 5 may be (negligably) faster, but the main benefit you get is in
          using/preparing to use a language that is more sane and developed and is the
          future of JavaScript. I'm sure you'll find lots of links as to the
          advantages if you google it. It shouldn't make your code slower.

          On 3 November 2010 13:34, James <jacob@...> wrote:

          >
          >
          > Yes, I understand. But why should I? If I always drive the speed limit, why
          > should I put a speed regulator on my car? There may very well be a reason, I
          > just want to know what advantage there is for me.
          >
          >
          > --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, "Rob
          > Richardson" <erobrich@...> wrote:
          > >
          > > "use strict" identifies you're opting into the ECMAScript 5 mode of the
          > same
          > > name.
          > >
          > > Rob
          >
          >
          >


          [Non-text portions of this message have been removed]
        • Joshua Bell
          ... This post has a reasonable summary: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ In browsers today, the use strict directive does nothing.
          Message 4 of 7 , Nov 3, 2010
          • 0 Attachment
            On Wed, Nov 3, 2010 at 6:34 AM, James <jacob@...> wrote:

            > Yes, I understand. But why should I? If I always drive the speed limit,
            > why should I put a speed regulator on my car? There may very well be a
            > reason, I just want to know what advantage there is for me.


            This post has a reasonable summary:

            http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/

            In browsers today, the use strict directive does nothing.

            In future browsers, the use strict directive will cause subtly different
            behavior in parts of ECMAScript you probably shouldn't be using anyway.
            JSLint attempts to warn you about some of those. Tracking es-discuss, it
            does not appear that there are any fully conforming ES5 implementations, so
            it is not possible to verify that your scripts are, in fact, strict-mode
            compliant. (That is, that they behave as you would expect.)

            IMHO, unless you are aware of the differences to the language that strict
            mode introduces, the safest thing to do at this point is to ask JSLint (or
            similar tools) to look for strict mode violations, but not deploy with a
            "use strict" directive.

            -- Josh


            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.