A script language "like" Rust?

I think the Rust community might needs a script language that retains the vast majority of Rust's syntax and maintains as much interoperability with Rust as possible, but can be hot-loaded for dynamic extension of the program without introducing scripting languages that are far removed from Rust's conventions and do not have the convenience of strict semantics, algebraic data types, etc. It can be interpreted or complied to bytecode, the main requirement is dynamically extensible.

There is Gluon, Gleam. OCaml's also very nice, thought not very easy to "embed"

Have you looked at the ones listed in Scripting Languages | Are we game yet? ?

I believe that wasm fits the requirements above.

I find the extism project interesting in that regard. It allows you to interoperate between Rust (and other languages) and wasm bytecode. I deem you could write your wasm plugin in Rust itself (removing the need for a Rust-like scripting language all together), compile it to a wasm file and plug that in during runtime.

I do considered wasm as the extension approach.

LGTM if interop is usable.

You could take a look at Microsoft's underrated F#. In case you are unaware this is now cross-platform and shares some of the same philosophy and syntax with Rust. There is also an F# to Rust compiler, though not at 1.0 level yet.

See also Rust for Fsharpers and F# for Rustaceans. This is written by someone who started with Rust.

F# is strongly-typed but can be used similarly to Python and can be run in Notebooks, used for AI etc.

I used F# before Rust, and was impressed with its ML features (also one of the main reasons why I came to love Rust so much), but then abandoned it due to (in my personal opinion) the lack of a more unified ecosystem. I'm really glad to see the progress of F#, especially in terms of relation to Rust. But like OCaml, which was mentioned earlier, F# is perhaps a bit too heavy as an extension language.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.