Message from JavaScript discussions

December 2018

β€” Okay, show me

β€” 

Hz makes it so all code in the whole program could run concurrently, and when you use spawn then this preparation is used... but also, if there is an un-prepared part of the code, it disrupts the concurrency from working at all

β€” 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

Message permanent page

β€” 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