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

Re: ' ' was used before it was defined

Expand Messages
  • Douglas Crockford
    ... I recommend that you heed JSLint s advice and declare your functions before you call them.
    Message 1 of 6 , Jul 27, 2008
      --- In jslint_com@yahoogroups.com, "montago_2004" <mdk@...> wrote:
      >
      > doit();
      >
      > function doit(){ }
      >
      >
      > //-----
      >
      > In ANSI-C its crusial that functions are defined before they are used
      > - either 'physically' or by a shadow in the head-section.
      >
      > C-compilers wasn't smart enough to look ahead, and thus wouldn't
      > compile unless functions came before Main...
      >
      >
      > In Javascript, the compiler/parser IS smart, and thus it look ahead
      > all files and all script, to find function definitions.
      >
      > therefore i find it somewhat annoying to be error'ed about the
      > chronology of my code ... :-)

      I recommend that you heed JSLint's advice and declare your functions
      before you call them.
    • re miya
      Yes, this is a good advice. It saves a lot of headaches. ... From: Douglas Crockford To: jslint_com@yahoogroups.com Sent: Sunday, 27
      Message 2 of 6 , Jul 27, 2008
        Yes, this is a good advice.

        It saves a lot of headaches.

        ----- Original Message ----
        From: Douglas Crockford <douglas@...>
        To: jslint_com@yahoogroups.com
        Sent: Sunday, 27 July, 2008 2:20:55 PM
        Subject: [jslint] Re: '<function>' was used before it was defined

        --- In jslint_com@yahoogro ups.com, "montago_2004" <mdk@...> wrote:
        >
        > doit();
        >
        > function doit(){ }
        >
        >
        > //-----
        >
        > In ANSI-C its crusial that functions are defined before they are used
        > - either 'physically' or by a shadow in the head-section.
        >
        > C-compilers wasn't smart enough to look ahead, and thus wouldn't
        > compile unless functions came before Main...
        >
        >
        > In Javascript, the compiler/parser IS smart, and thus it look ahead
        > all files and all script, to find function definitions.
        >
        > therefore i find it somewhat annoying to be error'ed about the
        > chronology of my code ... :-)

        I recommend that you heed JSLint's advice and declare your functions
        before you call them.



        Not happy with your email address?
        Get the one youreally want - millions of new email addresses available now at Yahoo!
      • montago_2004
        ... used ... I guess you are a teacher... or a blast from the past [B-)]
        Message 3 of 6 , Jul 27, 2008
          --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
          >
          > --- In jslint_com@yahoogroups.com, "montago_2004" mdk@ wrote:
          > >
          > > doit();
          > >
          > > function doit(){ }
          > >
          > >
          > > //-----
          > >
          > > In ANSI-C its crusial that functions are defined before they are used
          > > - either 'physically' or by a shadow in the head-section.
          > >
          > > C-compilers wasn't smart enough to look ahead, and thus wouldn't
          > > compile unless functions came before Main...
          > >
          > >
          > > In Javascript, the compiler/parser IS smart, and thus it look ahead
          > > all files and all script, to find function definitions.
          > >
          > > therefore i find it somewhat annoying to be error'ed about the
          > > chronology of my code ... :-)
          >
          > I recommend that you heed JSLint's advice and declare your functions
          > before you call them.
          >

          I guess you are a teacher...   or a blast from the past B-)
        • osteocosmosis
          ... I ve always assumed the headaches it saves are extended look-ups of the function that wastes time. Is this right? Or does it combat namespace pollution?
          Message 4 of 6 , Jul 28, 2008
            --- In jslint_com@yahoogroups.com, re miya <remiya_ws@...> wrote:
            >
            > Yes, this is a good advice.
            >
            > It saves a lot of headaches.

            I've always assumed the headaches it saves are extended look-ups of
            the function that wastes time. Is this right? Or does it combat
            namespace pollution?
          • Re Miya
            ... Waste of time? I never thought about this.
            Message 5 of 6 , Jul 28, 2008
              --- In jslint_com@yahoogroups.com, "osteocosmosis" <fredistic@...> wrote:
              >
              > --- In jslint_com@yahoogroups.com, re miya <remiya_ws@> wrote:
              > >
              > > Yes, this is a good advice.
              > >
              > > It saves a lot of headaches.
              >
              > I've always assumed the headaches it saves are extended look-ups of
              > the function that wastes time. Is this right? Or does it combat
              > namespace pollution?
              >
              Waste of time? I never thought about this.
            Your message has been successfully submitted and would be delivered to recipients shortly.