4 ms·
I think the real problem here is that JavaScript/Node.js is constrained by language choice to a hybrid continuation-passing/call-return style. As straightforwa
by amalcon 15y ago
I think the real problem here is that JavaScript/Node.js is constrained by language choice to a hybrid continuation-passing/call-return style. As straightforward as exceptions are in call-return, they are even simpler in CPS -- the exception handler is just a second continuation. It's literally just a standard-form onError parameter.
The problem is that you can't write your whole program in continuation-passing style in JavaScript, because its call and exception mechanisms aren't designed for CPS. There is no tail-call optimization, and you can't configure exception handlers manually. That's a valid choice under the right circumstances, but it breaks CPS.