nucleus-js / design

This repo is for the core design, discussion, spec, and tests for nucleus implementations.
Other
110 stars 20 forks source link

portable bindings #9

Open dominictarr opened 8 years ago

dominictarr commented 8 years ago

looking at the code here: https://github.com/creationix/nucleus/tree/master/implementations/duktape/duv

it looks like that is coupled to libuv and duktape, and wouldn't that mean that you would also have to rewrite that binding when you introduce jerryscript and others

That might be acceptable for if we only need to do it for libuv, but there are lots of other useful C libraries (leveldb and libsodium are the first I'll be needing)

What sort of approaches can be made so those bindings are generic, that it doesn't matter if I use jerryscript but the author of a binary lib that I use uses duktape?

creationix commented 8 years ago

I'm not sure we can make bindings be portable across all the engines. Their bindings use wildly different techniques/styles and even different languages (forth style stack machine in C vs C++ smart pointers for example). My plan is to standardize on the interface exposed to the JS and then write the bindings in whatever manner works best for each engine.

creationix commented 8 years ago

Now that I'm going down the road of using as much rust as possible, I think the bindings will be more portable. At least the rust-libuv bindings will be reusable across all backends written in rust.

dominictarr commented 8 years ago

wait, you are not reimplementing libuv in rust though, right? you are just writing nucleus in rust, so duktape is still C, right?

creationix commented 8 years ago

right