4 ms·
It helps syntactically but does nothing about the main problem: composability. Each of your functions has to know which function to call next, instead of just h
by Sharlin 12y ago
It helps syntactically but does nothing about the main problem: composability. Each of your functions has to know which function to call next, instead of just having one function that invokes n other functions in order. That's what next() is meant for.
- z3t4 12y agoFor composability in JS I use small utility modules like "inOrder": function beforeWifeComesHome() { takeTheTrashOut(); function takeTheTrashOut() { inOrder([openDoor, goOut, emptyTrash, goIn, closeDoor]); } } But it would be easier to let the compiler take care of the async calls and insert callbacks automatically so that you can think synchronously while the program works asynchronously. And if you want to run stuff in parallel you should use child processes.
- deleted 12y ago[deleted]