Live data from Hacker News

Roto: A Compiled Scripting Language for Rust

blog.nlnetlabs.nl

81–90 of 116 posts

Re: Roto: A Compiled Scripting Language for Rust

#81
post #23

Earlier quoted context omitted.

I have dreamed of this for Rust. It is literally _the_ killer app to have a fast scripting language that pairs with Rust well. With fast development cycles and a safe scripting language, Rust will find itself in every single programming niche. Server development, game development, desktop application development. If the WASM DOM bridge gets better, maybe even web development. Everything will open up. You can prototyp…

> game development I've been out of the loop for a while, but last I checked, the running gag was that there are more game engines written in rust than games. Have things changed? Any high profile games that were made in rust?

The biggest one I know of is Tiny Glade: https://store.steampowered.com/app/2198150/Tiny_Glade/

It's mostly a custom stack, but it's written in Rust and uses some parts of Bevy from what I understand.

Re: Roto: A Compiled Scripting Language for Rust

#82
post #8
post #5

Sidenote, but I wish it became the practice to explain abbreviations such as BGP, to make the post intelligible to people outside the field.

Border Gateway Protocol But I don’t even think people in networking would say that, it is canonically BGP. This is kind of like complaining about the abbreviation HTML, sure yes it is Hypertext Markup Language but everyone knows it as HTML to the point that there are probably people that don’t know it’s an abbreviation.

This reminds me of a trivia night event last weekend; in a room of 12 6-person teams I was the only one who knew exactly what the acronym URL stands for. But I'm confident a majority would have been able to come up with a reasonable working definition.

Re: Roto: A Compiled Scripting Language for Rust

#83
post #77

Earlier quoted context omitted.

It depends. I'd love to make a prototype using Bevy with Roto. What I'm trying to say is that if you only want something to make Rust compile faster, then Rust might the better option. If you want something that behaves more like a scripting language and you don't mind that is compiled at startup, then Roto might be good for that purpose (with the caveat that there are missing features of course).

Having not yet actually tried it, I assume I could compile at startup on a separate thread with no issues? This seems like a dream scripting language--or "application language" as someone else called it.

Yes, you definitely could! And thanks for the kind words! If you try it out for your own purposes, you'll probably run into some missing features (e.g. lists and loops), but we'd be happy to hear what you think!

Re: Roto: A Compiled Scripting Language for Rust

#84
post #47

Earlier quoted context omitted.

How is that not also stringly typed?

match Plugin::instantiate_async(&mut store, &component, &linker).await { Ok(plugin) => { match plugin .plugin_guest_oncallback() .call_ontimedcallback(&mut store, &callback_name) .await { Ok(()) => debug!("Successfully called oncallback for {plugin_path:?}"), Err(e) => warn!("Failed to call oncallback for {plugin_path:?}: {e}"), } } Err(e) => { error!("Failed to call oncallback for {plugin_path:?}!: {e}"); } } See th…

Thanks for using wasmtime! I worked on the component bindings generator you’re using and it’s really nice to see it out in the wild.

To elaborate a bit further: wasmtime ships a [bindings generator proc macro](https://docs.wasmtime.dev/api/wasmtime/component/macro.bindg...) that takes a wit and emits all the code wasmtime requires to load a component and use it through those wit interfaces. It doesn’t just check the loaded component for the string names present: it also type checks that all of the types in the component match those given by the wit. So, when you call the export functions above, you can be quite sure all of the bindings for their arguments, and any functions and types they import, all match up to Rust types. And your component can be implemented in any language!

Re: Roto: A Compiled Scripting Language for Rust

#85
post #84

Earlier quoted context omitted.

match Plugin::instantiate_async(&mut store, &component, &linker).await { Ok(plugin) => { match plugin .plugin_guest_oncallback() .call_ontimedcallback(&mut store, &callback_name) .await { Ok(()) => debug!("Successfully called oncallback for {plugin_path:?}"), Err(e) => warn!("Failed to call oncallback for {plugin_path:?}: {e}"), } } Err(e) => { error!("Failed to call oncallback for {plugin_path:?}!: {e}"); } } See th…

Thanks for using wasmtime! I worked on the component bindings generator you’re using and it’s really nice to see it out in the wild. To elaborate a bit further: wasmtime ships a [bindings generator proc macro]( https://docs.wasmtime.dev/api/wasmtime/component/macro.bindg... ) that takes a wit and emits all the code wasmtime requires to load a component and use it through those wit interfaces. It doesn’t just check th…

Would wasmtime be a good general purpose scripting extension layer for a C program in the style of embedded Lua but faster and more generic? Is that a reasonable use-case?

Re: Roto: A Compiled Scripting Language for Rust

#86
post #83

Earlier quoted context omitted.

Having not yet actually tried it, I assume I could compile at startup on a separate thread with no issues? This seems like a dream scripting language--or "application language" as someone else called it.

Yes, you definitely could! And thanks for the kind words! If you try it out for your own purposes, you'll probably run into some missing features (e.g. lists and loops), but we'd be happy to hear what you think!

Thank you for putting this out there! I'll make sure to let you know what I think when I try it out—but I have some wood to chop on other parts of my app before I get into scripting.

Re: lists and loops, is that not supported because it hasn't been a priority or because it requires some fundamental redesign? Which is to say, if I wanted to add those down the road, is this something I could try my hand at implementing on my own and possibly contributing back?

Re: Roto: A Compiled Scripting Language for Rust

#87
post #85
post #84

Earlier quoted context omitted.

Thanks for using wasmtime! I worked on the component bindings generator you’re using and it’s really nice to see it out in the wild. To elaborate a bit further: wasmtime ships a [bindings generator proc macro]( https://docs.wasmtime.dev/api/wasmtime/component/macro.bindg... ) that takes a wit and emits all the code wasmtime requires to load a component and use it through those wit interfaces. It doesn’t just check th…

Would wasmtime be a good general purpose scripting extension layer for a C program in the style of embedded Lua but faster and more generic? Is that a reasonable use-case?

Wasmtimes C bindings for components are still a work in progress. In general C programming is always going to require more work than Rust programming, due to the limitations of C abstractions, but at the moment it’s also held back by how much energy has gone into the C bindings, which is much less than the Rust bindings which many of the maintainers, myself included, created and are using in production at their day jobs.

More info: https://github.com/bytecodealliance/wasmtime/issues/8036 Several folks have volunteered work on the C bindings over the last year or two, with this contributor making progress most recently: https://github.com/bytecodealliance/wasmtime/pulls?q=is%3Apr...

Re: Roto: A Compiled Scripting Language for Rust

#88
Could you write 80-100% of an application in this language? I'm wondering if it could be a good application language for Rust programmers who want to use the Rust ecosystem and have the option of writing parts of their application in Rust for extra performance, but who also want to experiment and iterate quickly, and who want a simpler, higher-level language for expressing business logic.

Re: Roto: A Compiled Scripting Language for Rust

#89
> Roto has no facilities to create loops. The reason for this is that scripts need to run only for a short time and should not slow down the application. [1]

Wait, what?! Isn't that choice a bit extreme?

There have been plenty of times in scripting where I've needed loops! Am I missing something here?

[1] https://rotonda.docs.nlnetlabs.nl/en/stable/roto/00_introduc...

Re: Roto: A Compiled Scripting Language for Rust

#90
post #83

Earlier quoted context omitted.

Yes, you definitely could! And thanks for the kind words! If you try it out for your own purposes, you'll probably run into some missing features (e.g. lists and loops), but we'd be happy to hear what you think!

Thank you for putting this out there! I'll make sure to let you know what I think when I try it out—but I have some wood to chop on other parts of my app before I get into scripting. Re: lists and loops, is that not supported because it hasn't been a priority or because it requires some fundamental redesign? Which is to say, if I wanted to add those down the road, is this something I could try my hand at implementing…

They're on the roadmap for sure. While loops are quite easy to add I think, but it would also need an assignment operator to make it useful. Lists are complicated because they're generic over the element type. That's why I've waited so long to add them.
Post reply on HN