Ok, I apologize for the rudeness in my tone.  Let me explain what is going
on.

Your example fails not because the call is above the definition in the
file, it fails because the call happens before the definition in time.

My example has the call above the definition in the file but the definition
happens before the call in time.

So mine succeeds and yours doesn't.  The important thing for the
readability of the code is that the call is above the definition in the
file.  This makes the code read as if it is linear. The need for the extra
start() at the bottom is a small price to pay. Also, I only have this call
at the bottom of each module.


On Sat, Aug 17, 2013 at 1:39 PM, Mark Hahn <m...@reevuit.com> wrote:

> > ReferenceError: doNext is not defined
>
> Wrong.  Run it.  It works great.  The first two lines are just
> assignments.  So they are both defined when start runs.
>
> I've gotten this exact response when I've posted this before.  People
> blindly believe the myth.
>
> On Sat, Aug 17, 2013 at 1:26 PM, Andrew Kelley <superjo...@gmail.com>wrote:
>
>> doNext()
>> doNext = ->
>>
>> ReferenceError: doNext is not defined
>>
>> vs
>>
>> doNext()
>> function doNext() {
>>
>> }
>>
>> On Saturday, August 17, 2013 2:47:07 PM UTC-4, Mark Hahn wrote:
>>
>>> > First to note - Coffee-Script actually *prohibits* this kind of code
>>> organization, because all functions are necessarily assignments.
>>>
>>> It is a myth that you have to put function definitions before the
>>> calling code in coffee.  Here is a pattern I use in all my code ...
>>>
>>> start = -> doNext()
>>> doNext = -> ...
>>>
>>> start()
>>>
>>>
>>> On Fri, Aug 16, 2013 at 10:53 PM, Andrew Kelley <super...@gmail.com>wrote:
>>>
>>>>  I wrote this article as a response to all the recent callback hate:
>>>>
>>>> http://andrewkelley.me/post/**js-callback-organization.html<http://andrewkelley.me/post/js-callback-organization.html>
>>>>
>>>> It contains:
>>>>
>>>>    - Acknowledgement of better async syntax than what callbacks offer
>>>>    - Tips on how to structure callback based code
>>>>    - Reasons why you might want to stick with js instead of a
>>>>    compile-to-js language.
>>>>
>>>>  --
>>>> --
>>>> Job Board: http://jobs.nodejs.org/
>>>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-
>>>> **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 nod...@googlegroups.com
>>>>
>>>> To unsubscribe from this group, send email to
>>>> nodejs+un...@**googlegroups.com
>>>>
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<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+un...@**googlegroups.com.
>>>>
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<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.
>>
>
>

-- 
-- 
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