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

becoming closure

Expand Messages
  • Douglas Crockford
    JSLint will now accept var x = function () { ... x ... }; but will still warn on var x = x + 1;
    Message 1 of 3 , Jun 5, 2011
    • 0 Attachment
      JSLint will now accept

      var x = function () { ... x ... };

      but will still warn on

      var x = x + 1;
    • Rob Richardson
      Do I understand correctly that this is now legal?: var x = function () { ... x(); ... } and that we no longer need to do this: var x; x = function () { ...
      Message 2 of 3 , Jun 5, 2011
      • 0 Attachment
        Do I understand correctly that this is now legal?:

        var x = function () { ... x(); ... }

        and that we no longer need to do this:

        var x; x = function () { ... x(); ... }


        Does JSLint still balk at this?:

        var x = function () { ... x = 2; ... }

        Can you please make JSLint balk at this?:

        var x = function () { ... var x = 2; ... }

        Rob


        -----Original Message-----
        From: jslint_com@yahoogroups.com [mailto:jslint_com@yahoogroups.com] On
        Behalf Of Douglas Crockford
        Sent: Sunday, June 05, 2011 8:21 AM
        To: jslint_com@yahoogroups.com
        Subject: [jslint] becoming closure

        JSLint will now accept

        var x = function () { ... x ... };

        but will still warn on

        var x = x + 1;
      • Robert Sauer-Ernst
        so the memoizer function will pass now: var memoizer = function (memo, formula) { var recur; recur = function (n) { var result = memo[n]; if (typeof result !==
        Message 3 of 3 , Jun 6, 2011
        • 0 Attachment
          so the memoizer function will pass now:

          var memoizer = function (memo, formula) {
          var recur;
          recur = function (n) {
          var result = memo[n];
          if (typeof result !== 'number') {
          result = formula(recur, n);
          memo[n] = result;
          }
          return result;
          };
          return recur;
          };

          http://tech.groups.yahoo.com/group/jslint_com/message/2216




          --- Original Nachricht ---

          Von: Douglas Crockford <douglas@...>
          Am: Sun, 05 Jun 2011 15:21:08 -0000
          Betreff: [jslint] becoming closure
          An: jslint_com@yahoogroups.com
          CC:
          >
          > JSLint will now accept
          >
          > var x = function () { ... x ... };
          >
          > but will still warn on
          >
          > var x = x + 1;
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.