Live data from Hacker News

One year of Roto, a compiled scripting language for Rust

blog.nlnetlabs.nl

21–30 of 33 posts

Re: One year of Roto, a compiled scripting language for Rust

#22
post #4

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…

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

That makes a lot of sense to me. The implementation feels odd to me, though. If I’m reading it right, I type in literals normally and then all these hooks decide whether they want to change what I’ve typed in? It feels like I have to remember the custom literals I have installed to make sure I don’t accidentally conform to some spec and end up with a custom literal instead of the string I wanted.

Something like EDN readers seem saner to me where I wrap the value in something that denotes the function to use to parse the value. If I do “192.168.1.0/24” I get a string literal, if I do #cidr{192.168.1.0/24} then it hands the value off to the cidr custom literal.

That’s my 2 cents, I hate when things implicitly modify my literals.

Re: One year of Roto, a compiled scripting language for Rust

#23
I've been thinking a lot about a solution to Rust's notoriously slow compile times. From my research, it's not the borrow checker that is the issue, it's the heavy optimizations and monomorphization, and macro expansion [0]. There are efforts to improve Rust compile times, but I realized recently that it will never be lightning fast, so we (Rust users) should really be developing more scripting languages and DSLs that we can put all of the fiddly bits into.

Places where we would benefit the most from this is in the Games and UI space. I know game devs have already started by integrating lua, like with mlua [1]. In the UI space i think Makepad is the best example of a team making a dedicated DSL that can be hot-reloaded [2].

I think we need more of this! Go make a DSL next time you feel crushed by the weight of compiling Rust crates!

---

[0] and by my research i mean Claude. this is a great blog with many posts about improving compile times https://nnethercote.github.io/

[1] https://crates.io/crates/mlua . I don't have a reference for a project using it though so please reply if you know of one!

[2] https://github.com/makepad/makepad

Re: One year of Roto, a compiled scripting language for Rust

#24
post #15
post #4

Earlier quoted context omitted.

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

Have you considered collecting all the literals into domains, but ship them by default? I could, for example, imagine using roto in some of my current work on svg and visuals generation. In which case I'd be greatly helped with literals like "colors", "vec2", "angle" etc. I'd imagine that as long as other literals which I don't need, like an IP address, aren't in the way, it's still greatly beneficial to have a large…

Good suggestion! We haven't done that because there's only one domain at the moment but going forward that could be useful.

Re: One year of Roto, a compiled scripting language for Rust

#25

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…

7 years of python -> rust here.

https://github.com/py2many/static-python-skill/blob/main/ass...

Re: One year of Roto, a compiled scripting language for Rust

#26
Congratulations terts and team. In November’25 we had pleasure to interview you about roto and Nlnetlabs [1]. Happy how far it has come already. Before the summer ends We’ll implement support for it in rama [2] to support scripted services and anything else you might want! Looking forward to that day. Until then, keep it up!

[1]: https://netstack.fm/#episode-14

[2]: https://github.com/plabayo/rama

Re: One year of Roto, a compiled scripting language for Rust

#27
post #10

Maybe the authors are here to answer this. The syntax is of course very Rusty, which is cool. However, a sort of obvious question comes to mind - what is the benefit of this over just writing rust, then? Just because the compile times are shorter? EDIT: should mention I understand why embedded scripting languages exist, having embedded Lua many times. And I love a lot of these features, but to me having an embedded s…

Other commenters have given most of the reasons already, but since you asked specifically for the author, I'll chime in as well.

The fact that Roto gets compiled at the runtime of the Rust application is very important. That means we can ship a binary and still allow scripting.

We also believe that Rust is too complicated for our use case in some respects, we're trying to make something simpler. Our target audience for Rotonda is not people who necessarily know Rust. We can never be as simple as Lua because of the static typing, but we're trying our best.

And finally, we don't have to ship the entire Rust toolchain with our application. Roto is fully embedded into the binary with no external libraries needed and that's quite nice in practice.

Re: One year of Roto, a compiled scripting language for Rust

#28
post #4

Earlier quoted context omitted.

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

That makes a lot of sense to me. The implementation feels odd to me, though. If I’m reading it right, I type in literals normally and then all these hooks decide whether they want to change what I’ve typed in? It feels like I have to remember the custom literals I have installed to make sure I don’t accidentally conform to some spec and end up with a custom literal instead of the string I wanted. Something like EDN r…

That's kind of right, but they are adding new literals, not changing existing ones. The hooks are for the lexer and they can decide what syntax they accept. The syntax it defines would be a parse error if the hook is not used. But, indeed, this can be misused by accepting too much though, for instance when an IP addr also accepts a float. So the hook needs to be a bit careful.

The `#cidr{...}` syntax would work but then it wouldn't be much more convenient than just constructing the value with normal functions, I think.

Re: One year of Roto, a compiled scripting language for Rust

#29
Why do not call a 'record' a 'struct'?

Same with 'List' vs 'Vec'.

And why are List, String & co uppercase?

From what I gather these are built-in types the compiler knows?

'i32', not 'I32' but 'List' not 'list'? In Rust the case is clear cut: built-ins that the compiler 'knows' are lowercase, types expressed in Rust itself are PascalCase.

Roto seems to mix this?

Reads like Rust but then "differs subtley" where it (seemingly?) does not matter at all.

What is the rationale? I'm not complaining, Roto looks great. I'm considering swapping my Koto integration in my project out for this. :)

I'm just genuinely curious. From the outside the above smell like "just because" decisions.

Re: One year of Roto, a compiled scripting language for Rust

#30
the bash "scripting language" mimics the bash cli, it "scripts" what you can do in bash by hand and it does it by being bash.

I just think that's a nice way to use the word "scripting" instead of calling these scripts "programs" or calling things that are programs "scripts".

Post reply on HN