Closed dakom closed 6 years ago
C++ also needs such a solution. It isn't implemented yet.
If it were to be done, the way to do it would be the whole implementation of Node/Vertex including the garbage collector. But I don't like the idea of bringing C into other languages due to the complexity added by doing so. It seems to me the time would be better spent developing a test suite for Node/Vertex.
The real difficulty is Rust/C++ have stack-based allocation, and JavaScript/TypeScript do not. So js/ts can not use the strategy used in Rust. Rust/C++ can use the strategy used in js/ts but then you'll be forced to listen to all your sodium objects.
Stack-based allocation allows sodium objects that are sitting on the stack to be rooted as well in the GC. (It allows us to know they are in use)
OK closing this for now... I tried learning more about whether or not WebAssembly changes things... scrolled through some of this page and gave up: http://lambda-the-ultimate.org/node/5349
Interesting stuff in that thread though, worth checking out for anyone who's interested in this space.
It seems that at least two implementations require a builtin memory management solution.
Question... would it make sense to have a generic solution for all languages that require this, with a standard API, written in C?
My feeling is that most languages have some way of interfacing with that - e.g. typescript via emscripten/webassembly and rust via c bindings (or an api abstraction)
Just curious