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

Re: [jslint] Re: Early Unused Arguments

Expand Messages
  • Andy Dawson
    ... Please clarify why: foo(arg, function() { callThis(with, these, arguments); }); Is considered extremely sloppy. AD [Non-text portions of this message have
    Message 1 of 11 , Apr 30, 2012
    • 0 Attachment
      On 28 April 2012 13:17, sandyhead25 <austin.cheney@...> wrote:

      > **
      >
      >
      > While I understand the passing of functions as arguments of other
      > functions is a common style in many frameworks it is extremely sloppy.
      >

      Please clarify why:

      foo(arg, function() {
      callThis(with, these, arguments);
      });

      Is considered extremely sloppy.

      AD


      [Non-text portions of this message have been removed]
    • douglascrockford
      ... Yes it should, because it is often an error. But if you are intentionally writing code that looks like an error, and don t want to be reminded of that
      Message 2 of 11 , Apr 30, 2012
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "benquarmby" <ben.quarmby@...> wrote:

        > This argument aside (ba-dum-tish!), my real question is whether JSLint should allow early unused arguments. So translating my earlier sample:
        >
        > anythingFromAnyApi.onSomeEvent = function (a, b) {
        > iAmUsing(b);
        > };
        >
        > Should JSLint warn that "a" is unused when I can't control the number of arguments in this case?


        Yes it should, because it is often an error. But if you are intentionally writing code that looks like an error, and don't want to be reminded of that fact, then use the Tolerate unused parameters option.
      • benquarmby
        Thanks for the reply. Of course you re right (an annoying habit). Do you have a suggestion on creating callback / handler functions like this that don t look
        Message 3 of 11 , Apr 30, 2012
        • 0 Attachment
          Thanks for the reply. Of course you're right (an annoying habit).

          Do you have a suggestion on creating callback / handler functions like this that don't look like errors? (Other than "don't use stupid APIs" that is :)

          What do you think of this?
          http://tech.groups.yahoo.com/group/jslint_com/message/2863

          --- In jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:
          >
          > --- In jslint_com@yahoogroups.com, "benquarmby" <ben.quarmby@> wrote:
          >
          > > This argument aside (ba-dum-tish!), my real question is whether JSLint should allow early unused arguments. So translating my earlier sample:
          > >
          > > anythingFromAnyApi.onSomeEvent = function (a, b) {
          > > iAmUsing(b);
          > > };
          > >
          > > Should JSLint warn that "a" is unused when I can't control the number of arguments in this case?
          >
          >
          > Yes it should, because it is often an error. But if you are intentionally writing code that looks like an error, and don't want to be reminded of that fact, then use the Tolerate unused parameters option.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.