On Sunday, August 18, 2013, Mark Hahn 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. >
The problem is that your using the word "call" incorrectly in the latter. What you mean, based on the example you show below is "referenced". There can be a "reference" to a function before (spacially) it is defined by assignment (because to "declare" would hoist). The reference can even be a call site, as long as it isn't reached and evaluated before (temporally) the definition. Using the correct terminology to express a technical point is not optional. Rick 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 > [email protected]<javascript:_e({}, 'cvml', '[email protected]');> > To unsubscribe from this group, send email to > [email protected] <javascript:_e({}, 'cvml', > 'nodejs%[email protected]');> > 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 [email protected] <javascript:_e({}, 'cvml', > 'nodejs%[email protected]');>. > 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 [email protected] To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
