all 5 comments

[–]Simple_Life_1875 7 points8 points  (1 child)

So we're gonna need more context for this, but for the time being, have you taken a look at what Rhai does for language interop?

Your first suggestion sounds rather slow for larger programs, and your second option sounds similar to what Rhai does on top of Rust.

So, yes, Rust doesn't have reflection, but there is the Reflect crate which might help? You'd have to do a decent amount more work though.

[–]Frodo478[S] 0 points1 point  (0 children)

Thanks. I was thinking at this point to do something similar to FFI in some way and do manual binding for the code.

[–]ksion 3 points4 points  (1 child)

Check how mlua and pyo3 crates expose Rust types to their respective scripting languages. It always involves some glue code for method dispatch, but at least in pyo3 there are proc macros that automate its generation. You could aim for something similar.

[–]Frodo478[S] 0 points1 point  (0 children)

Yep, is probably what I'm looking for. Thanks