One year of Roto, a compiled scripting language for Rust

(blog.nlnetlabs.nl)

24 points | by Hasnep 1 day ago

3 comments

  • bakrisolo 2 minutes ago
    Stateless scripting languages are a massive win when embedding into Rust. Trying to snapshot or manage complex engine state across a runtime boundary usually turns into a complete nightmare anyway.
  • pveierland 19 minutes ago
    The syntax is of course attractive (coming from Rust), and I'd love to replace more of my posix scripts with something saner. I struggle understanding whether the utility of having language literals for IP addresses, IP prefixes, and AS numbers is worth it though [0]. It seems like the confusion added by having custom built-ins like this for one particular domain, in addition to the unclear scoping (what could later also deserve being a language literal), combined with special-case errors as famous in e.g. the YAML Norway problem, makes it seem like such features are better left as some general extension / macro / library capability.

    Nix is a language with built-in support for URI literals typed as strings [1], which is a source of confusion and edge-cases, and I believe the feature is now discouraged in general use.

    [0] https://roto.docs.nlnetlabs.nl/en/stable/reference/language_...

    [1] https://nix.dev/manual/nix/2.34/language/string-literals

    • terts 15 minutes ago
      Hi! Author here. We are actually planning on removing those literals and allowing applications to extend Roto with their own literals [0]. They should do so with care of course, because indeed adding more literals adds some edge cases. Most applications should be able to get by without any special literals though.

      [0]: https://codeberg.org/NLnetLabs/roto/pulls/358

      • pveierland 13 minutes ago
        Nice! That sounds like a good change. I'll try to dive a bit deeper through docs once I find some time :)
  • evrimoztamur 20 minutes ago
    Does anyone know if the Roto runtime is serde-able?

    A big problem I encountered in using Lua in Rust for my game engine was that I wasn't able to serde the Lua runtime such that I can snapshot a game session and save it in a file, and retrieve it in another context.

    • terts 11 minutes ago
      Hi! Author here. What we call the `Runtime` in Roto is not a state of the program, it's only the set of functions, types and constants that are available to the script. Roto scripts cannot really keep state at the moment. The advantage of that is that it allows you to run scripts in parallel. We're thinking about how we can keep that property while also having some state.