by fridgamarator on 6/16/19, 3:25 AM with 21 comments
by swordfeng on 6/16/19, 8:48 AM
There were several tough things however. The first was error handling. Yes you can catch exceptions in native code and convert it to exceptions in the other language, but it's not straightforward to keep stacktraces. The second was circular references between runtimes. Since references across boundaries are global, garbage collector on either side could not reclaim circularly referenced objects. Although this could be resolved by manually breaking up the circle, it could be better to have weak references. (Or maybe other utilities, idk what would be more elegant.) The third was that js has no operator overloading, so I had to use .__add__() for example to call the python add operator.
One line example: https://github.com/swordfeng/pyjs/blob/master/test/jsobject.... It's a toy project I did years ago and not even compiling now. Also I was wondering if anyone really need to do things in this way, given there are bunch of popular and stable RPC libraries. But I was happy to learn something about underlying cpython and v8 from it.
by rkeene2 on 6/16/19, 5:08 AM
All the Tcl runtime is in the "runtime" object, so like "runtime.puts('Hello World')" or "runtime.expr('2128')", etc
It was a lot of fun
by lmeyerov on 6/16/19, 4:17 PM
The current trick we're looking at is making this zero-copy when same-node, esp for GPU code, so happy to chat with folks about that!
by snek on 6/16/19, 1:38 PM
https://nodejs.org/api/n-api.html
We also have a c++ wrapper: https://github.com/nodejs/node-addon-api
by santa_boy on 6/16/19, 7:26 AM
by fermigier on 6/16/19, 11:10 AM
by rcfox on 6/16/19, 7:02 AM