Message from JavaScript discussions
December 2018
— Over-engeneering!
1. coroutine makes function call
2. call data is saved in queue
3. all other coroutines run
4. the coroutine in #1 finally gets to make the call
— This is the entire execution model
— There is nothing more to it
— It is "deferred execution"
— I disagree and in fact have a contrasting opinion, which is to say that I think JS is "under-engineered"
— Look at every other language capable of automatic concurrent execution, like I have, and I think you would change your mind because they have not treated the concept as over-engineering, instead treating it as an essential part of the execution flow
—
THREAD = function(chain){
var index, func;
index = 0;
func = function(){
window.requestAnimationFrame(function(){
switch (chain[index]()) {
case false:
func();
break;
case true:
case undefined:
if (chain[++index]) {
func();
}
}
return;
});
};
func();
};
you may put there setTimeout(), jobs done, it will simulate your
spawn
— There are many things that simulate it in the wild
— You would have to put a setTimeout at every expression
— But you can't take a thousand-line function with possibly hundreds of function calls and expect this to not lead to undue technical debt
— Why do i need that🤤