That is calling a function that is defined in an upper context. It IS
defined before the call, as the body of start does not run until the last
line. That is NOT hoisting, that is a result of Javascript exposing the
upper context by memory reference rather copying the memory at the time of
defining the function.
On 18 Aug 2013 09:51, "Mark Hahn" <m...@reevuit.com> wrote:

> I know coffeescript functions don't hoist.  I've been coding in nothing
> but coffeescript for almost three years.  Hoisting *is* needed to call a
> definition that hasn't been encountered yet in time.  But hoisting is *not*
> needed to call a function defined further down in the file.  It's the
> difference between space and time.
>
> Everyone keeps showing me code that doesn't work and ignores my code that
> does work.  My code has the call above the definition which is all that is
> needed to implement the desired pattern.
>
> start = -> nonHoistedFunc()                              # this call is
> ABOVE the definition below
> nonHoistedFunc = -> console.log 'this works'    # this definition is
> BELOW the call above
>
> start()  # this starts everything running, just needed once at bottom of
> module
>
> I use pretty much the pattern described in the blog in all my code.  I am
> going blue in the face trying to explain that the pattern works in
> coffeescript.
>
> It's not like I care what other people code.  I'm not evangelizing   It
> just drives me crazy that this is the second thread I've talked about this
> and no one has ever admitted my code works.  It is also a slight to
> coffeescript.
>
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to