Rhai: An embedded scripting language for Rust

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. steel

    An embedded scheme interpreter in Rust

    I haven't tried Rhai and I wouldn't call myself anything more than a casual Lua user, but from a glance, these could be some reasons I see others using Rhai instead of Lua:

    - Closer to Rust syntax, so easier if you already know Rust but don't know Lua

    - Built-in serde (popular Rust de/serializer) support, if you need that

    - Not sure if existing Rust<>Lua crates have it, but the debugging interface looks like the beginning of something useful (https://rhai.rs/book/engine/debugging/)

    - Made in Rust, so again, if you already use Rust (which you do, if this crate is an option) it'll most likely to be easier to change for your needs, than modifying a Lua runtime

    Personally, I'd probably still go for Lua rather than something like Rhai, if I had to choose something for algol-like scripting support. Otherwise I think Steel (https://github.com/mattwparas/steel) looks like the most sane scripting support for Rust.

  2. CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  3. Rhai

    Rhai - An embedded scripting language for Rust.

  4. Sophia

    Lisp like, embeddable and extendable scripting language supporting go interoperability (by xNaCly)

    According to the documentation it evaluates by walking the ast, so yes, this is considered very slow. The readme also mentions 1 million loop iterations in 0.14s (140ms). Even my unoptimised naive lips like language [1] (also implemented via a ast walker) does the same in 28.67ms - so yes id consider this pretty slow.

    [1]: https://github.com/xNaCly/Sophia

  5. Bazel

    a fast, scalable, multi-language and extensible build system

    You can say that for everything, after all of it's turing complete you can do anything.

    But practically, the difference is intention, which drives design and ecosystem.

    E.g: starlark is very oriented toward idenpotence and limiting side effects to get reproducible config data. By default they discourage reading files: https://github.com/bazelbuild/bazel/issues/13300

    But rhai is not particularly oriented toward config, and the doc promotes an extension to read files: https://rhai.rs/book/lib/rhai-fs.html

    The tutorials, stdlib, language design anf tooling will all reflect this.

  6. The MOAI Multi-platform Game Engine

    This is the development repo of Moai SDK.

    I've worked with moai (1) reasonably extensively, and the lua in it is not easy to use and sucks.

    Specifically, a project that is composed entirely of lua with no other dependencies is indeed very easy to build and maintain. I agree.

    However, my $0.02 would be that if you plan to have a large project with many 3rd party dependencies, then cmake, visual studio, C++, lua and the time spent jumping between them and maintaining those dependencies in a custom build toolchain will cost you more time and effort than the benefits that lua offers (2).

    ...and you do, indeed, need to do that, because c++ lacks a centralized package ecosystem and unified build tooling; and as operating systems change, existing builds stop working.

    So, yes, you may consider my answer to be 'rust'; but the actual answer is 'not C++ and not cmake'.

    [1] - https://github.com/moai/moai-dev

    [2] - ...and yes, I'm aware that moai is especially egregious in this regard. I get it.

  7. ChaiScript

    Embedded Scripting Language Designed for C++

    Since a quick ctrl-f didn’t find any mention here or on the README:

    I assume the name is a reference to ChaiScript, which is a similar embedded language for C++.

    https://github.com/ChaiScript/ChaiScript

  8. rsmodules

    The RSModules package is a tool to help you to modify your environment by using modulefiles.

    I use it in rsmodules https://github.com/fretn/rsmodules and I’m very happy with my choice. Was easy to implement and the earliest versions already offered what I needed.

    If the rhai author is reading this: thank you for this nice piece of software

  9. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  10. mlua

    High level Lua 5.4/5.3/5.2/5.1 (including LuaJIT) and Roblox Luau bindings to Rust with async/await support

    Is there something in specific that makes this easier to use in Rust projects compared to the Lua wrappers/bindings like mlua[0]? Or is it just an overall ergonomics thing?

    Genuine question, as I don't have any prior experience embedding any scripting language into a Rust project.

    [0]: https://github.com/mlua-rs/mlua

  11. helix

    A post-modern modal text editor.

    Other embedded scripting language is Steel [1]. It’s being considered to be used in Helix [2].

    [1] https://github.com/mattwparas/steel

    [2] https://github.com/helix-editor/helix/pull/8675

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

Did you know that Rust is
the 5th most popular programming language
based on number of references?