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

++

Expand Messages
  • Douglas Crockford
    I always use the plusplus option, so I never noticed that when it is off there is no checking of the operand of ++. JSLint now complains if the operand is not
    Message 1 of 5 , Jul 1, 2009
    • 0 Attachment
      I always use the plusplus option, so I never noticed that when it is off there is no checking of the operand of ++. JSLint now complains if the operand is not something that can be incremented.
    • sandyhead25
      Would you be able to use a brief example of code so that we could see such an occurrence in the context you are referencing?
      Message 2 of 5 , Jul 1, 2009
      • 0 Attachment
        Would you be able to use a brief example of code so that we could see such an occurrence in the context you are referencing?
      • Douglas Crockford
        ... --1; f()++; --a--; ++(a + b);
        Message 3 of 5 , Jul 1, 2009
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "sandyhead25" <austin.cheney@...> wrote:
          >
          > Would you be able to use a brief example of code so that
          > we could see such an occurrence in the context you are
          > referencing?

          --1;
          f()++;
          --a--;
          ++(a + b);
        • Merlin
          ... Could you please update http://www.jslint.com/jslint.js ? It is still showing 2009-06-17 edition. Harry.
          Message 4 of 5 , Jul 2, 2009
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
            >
            > I always use the plusplus option, so I never noticed that when it is off there is no checking of the operand of ++. JSLint now complains if the operand is not something that can be incremented.
            >
            Could you please update http://www.jslint.com/jslint.js ?

            It is still showing 2009-06-17 edition.

            Harry.
          • sandyhead25
            ... This thread implies the increment or decrement operator in the general sense, so I was clearly reading too much into the question. I would say this is
            Message 5 of 5 , Jul 4, 2009
            • 0 Attachment
              --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
              >
              > --- In jslint_com@yahoogroups.com, "sandyhead25" <austin.cheney@> wrote:
              > >
              > > Would you be able to use a brief example of code so that
              > > we could see such an occurrence in the context you are
              > > referencing?
              >
              > --1;
              > f()++;
              > --a--;
              > ++(a + b);
              >

              This thread implies the increment or decrement operator in the general sense, so I was clearly reading too much into the question.

              I would say this is entirely a nonissue. The operators are deemed potentially harmful. If they are not used then problems concerning them can be avoided. There does not exist any code written in JavaScript that cannot be rewritten to avoid use of these operators.

              The previous examples explained without the operators:
              --1 === 1 += 1
              f()++ === f() += 1
              --a-- === (1 -= a) -= 1
              ++(a + b) === (a + b) += 1
            Your message has been successfully submitted and would be delivered to recipients shortly.