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

Re: [jslint] Re: /*global */

Expand Messages
  • Arthur Blake
    ... It affects compression (albeit only a tiny bit unless you have a lot of global variables, which you shouldn t anyway...) And it goes against DRY. Probably
    Message 1 of 34 , Jun 1, 2009
    • 0 Attachment
      On Mon, Jun 1, 2009 at 1:40 PM, pauanyu <pcxunlimited@...> wrote:

      >
      >
      > I seem to be missing something here. Why are people okay with writing:
      > /*global $ */
      >
      > But not:
      > var $;
      >
      > This is very perplexing to me. Why would you choose a more verbose and
      > unnecessary syntax that is unsupported by ES5 strict-mode?
      > .
      >
      >
      >

      It affects compression (albeit only a tiny bit unless you have a lot of
      global variables, which you shouldn't anyway...)
      And it goes against DRY.
      Probably the main reason is just habit... (although that can be changed
      obviously.)

      I'm not saying I disagree completely, I just want to understand better why
      it was done... Are we really going to see ES5 adopted widely (and
      especially cross-browser-wise) any time soon?


      [Non-text portions of this message have been removed]
    • Douglas Crockford
      ... Which do you think is more likely, that a program wants to change the global name, or that a var name declaration in a function was forgotten? We won t get
      Message 34 of 34 , Jun 12, 2009
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "pauanyu" <pcxunlimited@...> wrote:
        > "name" needs to be writable. It has no value by default,
        > but you can assign a string to it, indicating the name of
        > the window/tab.

        Which do you think is more likely, that a program wants to change the global name, or that a var name declaration in a function was forgotten? We won't get an implied global warning, but at least we can get a read only warning. I think that is the more useful default.
      Your message has been successfully submitted and would be delivered to recipients shortly.