Roto: A Compiled Scripting Language for Rust
Syntax & Language Design
- Many note Roto’s syntax is very Rust-like; some see this as natural (Rust users like the syntax and want to reuse it), others prefer a distinct look (e.g. Lua, Koto) to separate host and script and avoid tying the language to Rust long term.
- There’s debate whether embedded languages must resemble the host; examples like Lua, Tcl, and ECL show they don’t, while newer Rust-adjacent projects often do.
- Roto is expression-oriented (like Rust:
if/elseas expressions) and statically typed, JIT-compiled, and hot-reloadable. - Initially Roto lacked loops to guarantee short-running filters; the author clarifies this is specific to its BGP engine use (Rotonda) and loops are likely to become optional elsewhere. Lists and generic collections are on the roadmap but harder to add.
Use Cases and Relationship to Rust
- Commenters are enthusiastic about a “killer app” scripting/application language for Rust: rapid iteration, hot reload, static typing, and tight interop while reserving Rust for performance-critical parts.
- Some ask if 80–100% of an app could be written in Roto; the author says yes in principle but notes limitations: no traits, no generic type registration (only concrete types like
Vec<u32>), and runtime compilation overhead. - Roto intentionally avoids Rust references and full Rust complexity to be simpler for end-users.
Alternatives and Comparisons
- Comparisons include:
- Lua, embedded JS engines (V8, QuickJS, Duktape), TypeScript, WebAssembly/wasmtime, Mun, yaegi, and simply dlopening Rust shared libraries.
- V8/TS are criticized as heavy (binary size, integration complexity), with concerns about TS’s type soundness for “mission-critical” filters; Roto is framed more as a domain-specific, lightweight option.
- Mun and wasmtime’s component model are cited as alternative plugin/hot-reload architectures; wasmtime gets praise for typed, non-stringly interfaces, though C bindings are still maturing.
- Using Rust shared libraries is questioned due to lack of stable Rust ABI and deployment complexity; Roto avoids requiring a Rust toolchain on target systems.
Execution Model, Safety, and Limitations
- Scripts don’t auto-run on load; the host chooses what to invoke and when, resembling C/C++ modules instead of typical dynamic-language “execute on import.”
- No
no_stdsupport is planned; the compiler itself allocates heavily. - Some see the no-loops design (for Rotonda) as overly restrictive; the author agrees the docs are outdated and that general-purpose Roto will likely include loops.
Acronyms and Documentation Clarity
- A substantial side-thread debates whether posts like this should spell out acronyms (e.g., BGP = Border Gateway Protocol).
- Some argue context-specific blogs can assume domain knowledge; others advocate the “first use: full term + acronym” convention to avoid alienating readers, noting abbreviations often have many meanings.
- There’s meta-discussion about LLMs guessing acronym meanings without context and the importance of specifying domain when querying them.