Live data from Hacker News

Roto: A Compiled Scripting Language for Rust

blog.nlnetlabs.nl

31–40 of 116 posts

Re: Roto: A Compiled Scripting Language for Rust

#31
In case the author comes in, I'm curious about how you designed the registration mechanism. We have a Python application that makes heavy use of decorators to give strong runtime introspection capabilities, and I've always wondered if the same could be done at or near compile time in an equivalent Rust context. I think learning about the drawbacks and boons of the designs you settled on would be really informative!

Re: Roto: A Compiled Scripting Language for Rust

#32
post #6
post #2

> Finally, we want a language that is easy to pick up; it should feel like a statically typed version of scripting languages you're used to. It looks like Rust. All Rust scripting languages do. Is this true for all other languages? Is this just a property of embeddable scripting languages, they will always resemble the language they're implemented in and meant to be embedded in?

IIRC Lua deliberately doesn’t resemble C - so if you’re going back-and-forth, editing both the host application code and a script, you can immediately tell which one you’re looking at. Makes sense to me - which means scripting languages for curly-brace languages should probably use either Lua-style begin-end or Python-style significant indentation.

I don't think that's the reason behind Lua's syntax. I think it was designed specifically to be extraordinarily unambiguous, clean, and simple, which it is.

Re: Roto: A Compiled Scripting Language for Rust

#33
post #2

> Finally, we want a language that is easy to pick up; it should feel like a statically typed version of scripting languages you're used to. It looks like Rust. All Rust scripting languages do. Is this true for all other languages? Is this just a property of embeddable scripting languages, they will always resemble the language they're implemented in and meant to be embedded in?

> Is this just a property of embeddable scripting languages, they will always resemble the language they're implemented in and meant to be embedded in? No. Think about Lua or Tcl (both implemented in C) or others like Embeddable Common Lisp.

True, but those were designed in the 80s or 90s. I guess I'm thinking of embedded scripting languages designed since ~2015.

Re: Roto: A Compiled Scripting Language for Rust

#34
post #6
post #2

> Finally, we want a language that is easy to pick up; it should feel like a statically typed version of scripting languages you're used to. It looks like Rust. All Rust scripting languages do. Is this true for all other languages? Is this just a property of embeddable scripting languages, they will always resemble the language they're implemented in and meant to be embedded in?

IIRC Lua deliberately doesn’t resemble C - so if you’re going back-and-forth, editing both the host application code and a script, you can immediately tell which one you’re looking at. Makes sense to me - which means scripting languages for curly-brace languages should probably use either Lua-style begin-end or Python-style significant indentation.

It is one of my issues with lua. I'm starting to forget semicolons in C/C++/Rust and write : instead of ::.

I think, that I'd better deal with a language recognition, I could configure emacs to use different highlighting for different languages. Or I could change background color for buffers based on a language.

Re: Roto: A Compiled Scripting Language for Rust

#35
Very cool!

But I prefer the wasmtime webassembly component model approach these days.

Built a plugin system with that, which has one major upside in my book:

No stringly function invocation.

Instead of run_function("my-function-with-typo") I have a instantiated_plugin.my_function call, where I can be sure that if the plugin has been instantiated, it does have that function.

Re: Roto: A Compiled Scripting Language for Rust

#36

ELI5: Why not use typescript and an embedded v8 engine or deno to run them? What kind of advantages will I miss if I go for typescript as an embedded language for my application? Also by using v8, I open up new possiblities via wasm (write in any lang and run it here?) Will be helpful if somebody enlighten me.

Be warned that V8 is a behemoth and adds 100+MB to your binary size, is quite slow to link, and is not practical to compile from source for most projects. If you want a lighter weight JS runtime there's quickjs, if you want WASM there's wasmtime.

Personally I don't think it's a good choice for what it seems Roto is used for (mission critical code that never crashes) since TS doesn't have a sound typesystem and it's still very easy to fuck up without additional tooling around it.

Re: Roto: A Compiled Scripting Language for Rust

#37

ELI5: Why not use typescript and an embedded v8 engine or deno to run them? What kind of advantages will I miss if I go for typescript as an embedded language for my application? Also by using v8, I open up new possiblities via wasm (write in any lang and run it here?) Will be helpful if somebody enlighten me.

You are comparing a general purpose scripting language (TypeScript) to a DSL (Domain Specific Language) essentially. They built theirs with a specific purpose.

Re: Roto: A Compiled Scripting Language for Rust

#38
post #20
post #8

Earlier quoted context omitted.

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.

A LLM response so don't trust it, but Biological and Genetic Programming: In biology, BGP can refer to methods or algorithms used in genetic programming or bioinformatics. BGP (Bureau of Governmental Personnel): In some governmental contexts, BGP may refer to a specific bureau or office related to personnel management. BGP (Bureau of Geographical Planning): In urban planning or geography, it might refer to a bureau t…

This is what people mean when they say "prompting an LLM is like the old google-fu; some people have it, some don't".

Try this prompt instead:

"Please explain the meaning of BGP in the following snippet: The need for Roto comes from Rotonda, our BGP engine written in Rust. Mature BGP applications usually feature some way to filter incoming route announcements. The complexity of these filters often exceed the capabilities of configuration languages. With Rotonda, we want to allow our users to write more complex filters with ease. So we decided to give them the power of a full scripting language."

Re: Roto: A Compiled Scripting Language for Rust

#39

ELI5: Why not use typescript and an embedded v8 engine or deno to run them? What kind of advantages will I miss if I go for typescript as an embedded language for my application? Also by using v8, I open up new possiblities via wasm (write in any lang and run it here?) Will be helpful if somebody enlighten me.

Roto is a very limited scripting language with no loops. You might compare it with the eBPF language used to load filters into the Linux kernel.

Re: Roto: A Compiled Scripting Language for Rust

#40
post #36

ELI5: Why not use typescript and an embedded v8 engine or deno to run them? What kind of advantages will I miss if I go for typescript as an embedded language for my application? Also by using v8, I open up new possiblities via wasm (write in any lang and run it here?) Will be helpful if somebody enlighten me.

Be warned that V8 is a behemoth and adds 100+MB to your binary size, is quite slow to link, and is not practical to compile from source for most projects. If you want a lighter weight JS runtime there's quickjs, if you want WASM there's wasmtime. Personally I don't think it's a good choice for what it seems Roto is used for (mission critical code that never crashes) since TS doesn't have a sound typesystem and it's s…

There's also Duktape for just JS minus the WASM (at least I don't think they've implemented WASM yet).

https://duktape.org/

Post reply on HN