Live data from Hacker News

One year of Roto, a compiled scripting language for Rust

blog.nlnetlabs.nl

11–20 of 33 posts

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

#11

    fn contains(range: &AddrRange, addr: &IpAddr) -> bool {
      range.min 
Looks ugly as fudge.

Syntax is not everything, but it also shows that people too easily think they are great at language design when they really aren't. It's fascinating to watch how people continue with such an approach. How many people are going to use that over, say, python?

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

#12
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…

Hot-reloading. You can edit your logic without rebuilding and restarting the host application; this cuts your iteration time from minutes to seconds, especially if the application is in a state that would need to be recreated.

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

#13
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…

Same reason why several projects have integrated Lua to their runtime over the past 30 years. Extensibility and hot reloading.

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

#14
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…

I'm author of a rust based task manager (not (yet) FLOSS, unfortunately), where we needed "pluggable task sources" (jira, github, trello, etc).

In our setup, the "sources" are more like configuration. Whereas the core, the business logic, is more like code.

Typically, one would configure with e.g. YAML. As we can see in many projects, that have a DSL, in yaml (k9s, GitHub actions, ansible, etc). But, rather than inventing another DSL in yaml, we realized we do need some logic, something very poorly expressed in yaml. And we went for Lua.

Long story to say: if your config typically has some logic in it, it makes sense to go for an embedded scripting language to provide it, rather than building it into the core domain, or to invent yet-another-yaml-amalgation (yayamla?)

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

#15
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

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 lib to pick and choose from, around.

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

#16

fn contains(range: &AddrRange, addr: &IpAddr) -> bool { range.min Looks ugly as fudge. Syntax is not everything, but it also shows that people too easily think they are great at language design when they really aren't. It's fascinating to watch how people continue with such an approach. How many people are going to use that over, say, python?

  def contains(range_: AddrRange, addr: IpAddr) -> bool:
    return range_.min 
I don't get it, how is that much better?

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

#17

fn contains(range: &AddrRange, addr: &IpAddr) -> bool { range.min Looks ugly as fudge. Syntax is not everything, but it also shows that people too easily think they are great at language design when they really aren't. It's fascinating to watch how people continue with such an approach. How many people are going to use that over, say, python?

you missed the closing bracket.

glad you like python, but a good reason to use this is setup being easier, also for people using rust, chances are the syntax is better compared to python. (also for what its worth, i picked up rust MUCH faster than i ever did with python)

the main reason i like rust is its explicitness in typing along with its syntax choices. memory safety means little imo, outside of being difficult to do strange stuff (which could be good or bad depending on your approach)

cargo add roto

code main.rs

-FILE- main.rs use roto::*;

fn main(){ roto::init_runtime() roto::load_script("hello.roto") }

-FILE-END-

code hello.roto

-FILE- hello.roto fn main() { print("Hello, world!"); } -FILE-END-

cargo run

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

#19
post #18

Are there any comparisons to other Rust scripting languages like Rhai and Rune?

Rhai is dynamically typed and uses reference counting, Rune has a full VM with a borrow checker, and Roto compiles to bytecode. The tradeoff is basically faster iteration with Rhai vs faster execution with Roto, with Rune sitting somewhere in the middle but feeling heavier.

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

#20

fn contains(range: &AddrRange, addr: &IpAddr) -> bool { range.min Looks ugly as fudge. Syntax is not everything, but it also shows that people too easily think they are great at language design when they really aren't. It's fascinating to watch how people continue with such an approach. How many people are going to use that over, say, python?

Hi! Author here. You're looking at Rust code there. Roto is very similar but without `&`. I wont pretend to be good at language design, but being similar to Rust has many advantages.
Post reply on HN