Message from JavaScript discussions
December 2018
— 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🤤
— HZ is not void of technical debt, in fact the point is to shift the technical debt from the developer to the compiler/dispatcher
— To be able to pause / interrupt at any point in the function using the event loop
— They are complex because the complexity needed somewhere to go, out of the developer's list of concerns
— I only need to control *big* parts, under CPU it will go as fast as light.. there is no reason to stop/check at each expression, it will slow-down the whole process