Re: [nodejs] Callbacks are Pretty Okay

2013-08-21 Thread Jake Verbaten
Just for comparative reference, here is a generators implementation ( https://gist.github.com/Raynos/56da201abbb50992ad06 ) I refactored the weird part into a `unique` function. Things that are worth noting are: - how easy `if` statements are with generators - you can replace 90% of the

Re: [nodejs] Callbacks are Pretty Okay

2013-08-18 Thread Floby
javacript : doNext () function doNext () { } this works as (not for me) expected. coffescript : doNext () doNext = - compiles to : var doNext ; doNext (); doNext = function () {} ^ this doesn't work. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

Re: [nodejs] Callbacks are Pretty Okay

2013-08-18 Thread Rick Waldron
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

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Mark Hahn
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 =

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Andrew Kelley
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

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Mark Hahn
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

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Mark Hahn
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

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Andrew Kelley
You didn't sound rude to me - it's fine. I am specifically talking about calling a function before defining it. That's the whole point. What I said holds true. On Saturday, August 17, 2013 5:02:51 PM UTC-4, Mark Hahn wrote: Ok, I apologize for the rudeness in my tone. Let me explain what is

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Mark Hahn
The blog that the OP pointed to said that in coffeescript you can't place the calling code higher in the file than the called function definition. He was wrong. He ruled out coffeescript for this reason. That is incorrect and you can code the style he is promoting in coffeescript. I felt this

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Mark Hahn
Oh, I just realized he is you. Again I hope you don't think I'm rude. On Sat, Aug 17, 2013 at 4:12 PM, Mark Hahn m...@reevuit.com wrote: The blog that the OP pointed to said that in coffeescript you can't place the calling code higher in the file than the called function definition. He was

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Andrew Kelley
I don't feel any rudeness from you. But I do feel like we're failing to communicate. Maybe someone else can chime in? On Saturday, August 17, 2013 7:13:53 PM UTC-4, Mark Hahn wrote: Oh, I just realized he is you. Again I hope you don't think I'm rude. On Sat, Aug 17, 2013 at 4:12 PM, Mark

Re: [nodejs] Callbacks are Pretty Okay

2013-08-17 Thread Mark Hahn
I do feel like we're failing to communicate It appears so. Let me try to phrase it in two questions. If you could give simple answers to these then we can make progress in our communication. 1) Did your blog say that because you couldn't call a function defined below the call in

[nodejs] Callbacks are Pretty Okay

2013-08-16 Thread Andrew Kelley
I wrote this article as a response to all the recent callback hate: 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