Message from JavaScript discussions

December 2018

β€” What to show? There is no threads in browser🀀 If they make some good interface, someday, maybe

β€” 

So even non-concurrent code must run concurrently to enable the concurrent code to run, the only difference is that the former is run in a "logically" non-concurrent mode so it thinks it is running regularly

β€” It's a trick

β€” 

const logForever = n => {
while (true) console.log(n);
};


make logForever run concurrently with itself, logging:
1
2
1
2
1
2

Message permanent page

β€” How do you decide to do this without hertz?

β€” Pretty simply, recursive setTimeout

β€” With hertz:

spawn logForever(1);
spawn logForever(2);

β€” Its when your code scales up when that becomes costly

β€” Without changing the implementation of logForever

β€” Ah, right, you would have to without hz

β€” Using setTimeout inside logForever breaks the point

β€” Because the point is to make synchronous code concurrent