3 ms·
Also, how would script feature detect whether the VM implemented TCO? Code written assuming TCO would still run, but very inefficiently.
by cpeterso 11y ago
Also, how would script feature detect whether the VM implemented TCO? Code written assuming TCO would still run, but very inefficiently.
- dsp1234 11y agoFor Node.js, define a simple function that does minimal computation, but that would blow the stack if called say a million times[0]. Run that function inside of a new vm context[1]. If it errors with a stack overflow, then no TCO. [0] - function n(x){if(x > 0) n(x-1)} [1] - https://nodejs.org/api/vm.html#vm_vm_runinnewcontext_code_sandbox_options https://nodejs.org/api/vm.html#vm_vm_runinnewcontext_code_sa...