aabtop / reify

Reify lets you embed a customized TypeScript runtime within a C++ application.
MIT License
6 stars 0 forks source link

Refactor V8 bindings so that IDT objects create an embedded shared_ptr C++ component. #4

Closed aabtop closed 4 years ago

aabtop commented 4 years ago

Whenever a JavaScript IDT object is created, it should result in the creation of a pure C++ shared_ptr object as well. So you will have the JavaScript wrapper which is wrapping an object that knows nothing about JavaScript. The wrapped object ought to be immutable so that it can be passed off immediately to other systems.

It's not clear to me at the moment if it would be better to just duplicate the object data within the wrapper, so that JavaScript can access the data (if it needs to) without crossing through the bindings layer, potentially speeding things up, and definitely simplifying things.

An implication here is that when linking together objects that reference other objects, the links will definitely need to be duplicated by the wrapper (so that JavaScript can traverse the link, and keep referenced objects alive for the GC), but also so the JS-independent wrapped object to be able to express the link.

aabtop commented 4 years ago

I consider this done with 130e051b460b4134551aeca4c7f2ab4758d46a0a !

The C++ side of the object is now created only when it is returned to C++.