Message from JavaScript discussions

December 2018

— It is the only REPL written in JS that lets the code run alongside the REPL interface in 1 thread


So you write an infinite loop like while (true) and it does not block the REPL even though they exist in the same script, in one NodeJS process only

— It's quite crazy

— The core code that makes that part operate is very small


process.stdin.on("data", code => {
const hzModule = new Function(
"return " + hzCompile("(function (){" + code.toString() + "})", false, false, true) + ";"

Message permanent page

— hzCompile is a magical compiler pipeline that makes the code interruptible, and hzDisp is the runtime... called with runAsync(30) it schedules a chunk of the code in the regular JS event loop every 30ms, meaning other things which are scheduled in the loop (like the REPL input) can work every 30ms or so

Message permanent page

— You mean, you can control execution pressing buttons in the console?🤤

— You could if I added the buttons

— I mean keyboard buttons🤤

— Ahh no

— There is no code stepping yet

— I need to do source mapping first