> So there are certainly uses for sync iteration tools (like _.each())
_.each() is NOT blocking, anymore than "var x = 1" is blocking, "callback(error, result)", or asynchronous_operation(callback) is blocking. It introduces NO synchronous waits. It cannot magically decompile your nonblocking system calls, and recompile them as blocking system calls or insert "while(true)"s. You have to explicitly add the blocking code yourself.
> Do you know/assume that the function itself takes care of the async aspects, or do you know/assume that the caller must take care to set up that structure?
It's still nonblocking. Whether one figured out how to pass all the parameters to a function and complete their intended code is a different question then whether or not completed code is blocking. Is this code blocking? == Does this code introduce undesirable synchronous waits and stalls?
Seriously, write a simple C program and prove all of this to yourself.
_.each blocks. Yes, you are right that it does it in the same way that "var x = 1" blocks.
You cannot interrupt "var x = 1" and you cannot interrupt a javascript forEach while it is looping over an array. With a really large array this is going to cause problems, like that infamous fibonacci example.
_.each() is NOT blocking, anymore than "var x = 1" is blocking, "callback(error, result)", or asynchronous_operation(callback) is blocking. It introduces NO synchronous waits. It cannot magically decompile your nonblocking system calls, and recompile them as blocking system calls or insert "while(true)"s. You have to explicitly add the blocking code yourself.
> Do you know/assume that the function itself takes care of the async aspects, or do you know/assume that the caller must take care to set up that structure?
It's still nonblocking. Whether one figured out how to pass all the parameters to a function and complete their intended code is a different question then whether or not completed code is blocking. Is this code blocking? == Does this code introduce undesirable synchronous waits and stalls?
Seriously, write a simple C program and prove all of this to yourself.