fubark / cyber

Fast and concurrent scripting.
https://cyberscript.dev
MIT License
1.16k stars 38 forks source link

Question on libtcc #50

Closed bentxt closed 1 year ago

bentxt commented 1 year ago

Hi I'm interested in cyber, but there a few points in the documention that raises a fundamental question on the 'philosophy' behind the extensibility of cyber.

I had the expectation that with the help of the host beeing written in Zig, the simple extensibility of cyber would be an important feature. But instead there is this whole bit on C compatibility and the introduction of the libtcc dependency.

https://fubark.github.io/cyber/docs/toc/ffi/

Cyber supports binding to an existing C ABI compatible library at runtime. and Cyber uses libtcc to JIT compile the bindings so function calls are fast

Why? Sounds pretty complicated, I mean there is Zig ...

On the other hand there is no documentation on Embedding yet.

Could you help me to understand on how this is thought out? It's very good possible I get something wrong here, or at least I miss something here.

Thanks

fubark commented 1 year ago

FFI is for your scripts to call into libraries. Embedding is for adding the Cyber compiler and interpreter into your own app. For that there are examples: https://github.com/fubark/cyber/tree/master/examples/c-embedded and https://github.com/fubark/cyber/tree/master/examples/web-playground

fubark commented 1 year ago

Please open another issue if you are still having issues/questions. I am aware that Embedding docs is not available, I want to use it myself in an actual project before I finalize the API. But you can definitely use Cyber for embedding.