4 ms·
It's a kludge. Syntactic sugar to remove one level of nesting. Other languages come either with great concurrency support out of the box (Go, Erlang) or enough
by q3k 9y ago
It's a kludge. Syntactic sugar to remove one level of nesting.
Other languages come either with great concurrency support out of the box (Go, Erlang) or enough constructs to implement cooperative schedulers without having to specify async/await (Lua).
- vsviridov 9y agoWhat's wrong with that?
- cdata 9y agoNot disagreeing, but as a long time JavaScripter it is remarkable to me that no matter how delightful or expressive or ergonomic the language tries to become, the same old criticisms manage to evolve with it (this may not be unique to JS). [Edit] JS has long been criticized (fairly or not) for offering clunky "concurrency" strategies. If you must down vote, please have the decency to offer a counter perspective.
- Jim99 9y agoAs someone who has been around for a long time and manages teams using many different languages (C,C++,C#,Java,Python,JavaScript) my JavaScript/Web teams are the most problematic in terms of cost/performance/gating bugs/upgrades/multi-platform support. The JavaScript critiques that you see are just an expression of the time and resources being wasted.
- cdata 9y agoWhere in the stack did you spend your time before you became a manager?
- deleted 9y ago[deleted]
- sametmax 9y agoIf you have callbacks, you end up with hard to read and debug code. If you have transparent async, then: Then how do you know what blocks and what doesn't ? What's asynchronous and what's going to trigger a switch ? What's a disguised callback and what's the next line ? What's the solution then ?
- balfirevic 9y agoWhy would you need to know, except in some special cases? If you're using async/await, your next line is not executing anyway until the result comes, blocking or not.
- sametmax 9y agoBecause otherwise you block the even loop or mismatch life cycle. Espacially reading an unfamiliar code base.
- z3t4 9y agoembrace higher-order functions. Use named functions and closures! example code: var anchors = document.getElementsByTagName(“a”); for(var i=0,len=anchors.length; i<len; i++){ alertClickAnchor(i); // Named function } function alertClickAnchor(i) { // Closure anchors[i].onclick = function() { alert(i); } }