Open RossComputerGuy opened 7 years ago
Pretty interesting, seems it could be the basis for runtime.js Javascript-based processes :-) or at least threads :-P
Right now, it doesn't fully work. It returns undefined
when I run __SYSCALL.evalContext({ print: (txt) => txt },"print(\"Hi\");")
Does it print?
No
Very cool, I think this would be similar to https://nodejs.org/api/vm.html#vm_vm_runinnewcontext_code_sandbox_options
Unfortunately, contexts can't run in parallel with other contexts in the same isolate (vm instance). They're like an iframes in the browser, have their own global objects, but share the same heap.
Recently, I've been messing around with the Runtime.js kernel. I've created a syscall that can allow a script to be evaluated in its own context. Here is the code: