The Koto Programming Language
Role of Koto and Rust’s “companion language” gap
- Many see Koto as “Lua for Rust”: a lightweight embedded scripting language letting users customize Rust applications at runtime.
- Several comments stress this is not a criticism of Rust, but a standard pattern: native core + sandboxed scripting (like JS in browsers, Lua in Nginx).
- Others argue the proliferation of Rust-hosted scripting languages reflects Rust’s lack of “less strict” / dynamic modes for rapid prototyping or non-critical code.
Rust vs dynamic / higher-level features
- Debate over whether Rust should add dynamic/relaxed contexts, reflection, or GC options:
- Some want C#-like features (dynamic, reflection, configurable checked contexts) and see resistance as cultural “zealotry”.
- Others respond that Rust’s no-runtime, C++-like constraints make such features fundamentally hard to reconcile with borrow checking and safety guarantees.
- Prototyping in Rust is defended: using
clone,Arc,RefCell,unwrap, etc. is seen as a practical “escape hatch”.
Typing: dynamic, optional, and “Rust-with-GC”
- Koto is dynamically typed but recently gained optional runtime type checks; these can be disabled for performance.
- Long subthread on why scripting languages are usually dynamic:
- Dynamic typing is easier to implement and more flexible for REPLs, live coding, and mid-session experimentation.
- Static inference with subtyping is technically hard; several research efforts are cited.
- Multiple people express desire for a Rust-like language with GC instead of a borrow checker; many alternatives are mentioned (OCaml, F#, Scala, Gleam, Roc, D, V, Nim, etc.), none clearly “perfect”.
Comparisons: Koto vs Rhai, Lua, others
- Rhai is seen as more OO and feature-rich (operator overloading, currying, safety guarantees), but slower (AST-walking) and lacking first-class functions.
- Koto is reported ~1.5–2x faster than Rhai in informal tests, but still slower than Lua; it optimizes Rust interop by sharing representations (e.g. strings, vectors).
- Some users stick with Lua (or LuaJIT) because of maturity, speed, and existing tooling, but like Koto’s Rust-native ergonomics.
Syntax, ergonomics, and concerns
- Koto’s CoffeeScript/MoonScript-inspired, whitespace-sensitive, paren-optional syntax is praised as elegant but criticized as potentially ambiguous and “footgunny”.
- Critics prefer stricter, more explicit syntax to ensure that small typos cause obvious syntax errors rather than subtle semantic changes.
Koto’s roadmap and stability
- The creator positions Koto primarily as an embedded language, not requiring Rust knowledge to use.
- Pre-1.0 priorities: async support, formatter-friendly parsing, FFI and package story, and a Rust-style “editions” approach to avoid a breaking 2.0.
- Some users already use Koto for editor scripting and shell-like tasks, reporting compile/startup fast enough for such use.