We are happy to announce version 0.10.0 of Roto, the statically-typed, compiled, embedded scripting language! This release is packed with new features such as lists, for loops, type parameters and variant types.
As always, you can find the release in the following places:
Below is the full list of changes!
Meta
- We now have a
CONTRIBUTING.md,TESTING.mdandSECURITY.md. (#333)
Language
Breaking changes
- Changed the
typekeyword torecord. (#297)
# Roto 0.9.0
type Vec2 {
x: f32,
y: f32,
}
# Roto 0.10.0
record Vec2 {
x: f32,
y: f32,
}
- The
LOCALHOSTV4andLOCALHOSTV6constants are not longer global but live
underIpAddras associated constants. (#292)
Added
- Lists are now supported! See the documentation for more information. (#301)
let x: List[i32] = [1, 2, 3];
let y = [4, 5, 6];
let z = x + y;
- Roto now has
varianttypes. These are much likeenumtypes in Rust. (#293)
variant Either[L, R] {
Left(L),
Right(R),
}
- Record types can now have type parameters. (#298)
record Pair[A, B] {
a: A,
b: B,
}
- In addition to
whileloops, there are nowforloops to iterate over lists. (#346)
let total = 0;
for x in [1, 2, 3, 4] {
total = total + x;
}
- The
StringBuftype was added to allow building strings character by
character more efficiently. (#300)
let buf = StringBuf.new();
buf.push_char('H');
buf.push_string("ello, World");
buf.push_char('!');
let s: String = buf.as_string();
- The
chartype was added, representing a single Unicode code point. (#300)
let a: char = 'a';
-
The repository now contains a basic Sublime Text grammar. This can be used
for syntax highlighting in Sublime Text, VS Code, Typst and other
applications. (#291) -
If you use common keywords from other languages, Roto will now hint about what
the appropriate Roto keyword is. (#322) -
If you try to use
//or--for comments, Roto will hint that you should
use#. (#322)
Bug fixes
- Error messages with non-ASCII characters now display correctly. Thanks @LevitatingBusinessMan! (#325)
- Type errors are now slightly more informative by printing the id’s associated
with type variables, instead of printing just an_. (#308)
Crate
Breaking changes
- The MSRV is now 1.85. (#288)
- The context of a
Runtimeis now a type parameter of theRuntimetype. (#274) - The
Reflecttrait has been renamed toValue. (#304) RuntimeandPackagenow have a type parameterC, which can be eitherNoCtxor
Ctx<T>, representing whether it has a context type. (#274)- The method
Runtime::register_context_typehas been replaced with
Runtime::with_context_typewith slightly different behaviour. Instead of
taking a mutable reference to the runtime, it takes it by value and returns
it. (#274)
// Roto 0.9.0
let mut rt = Runtime::new();
rt.register_context_type::<MyContext>();
// Roto 0.10.0
let rt = Runtime::new().with_context_type::<MyContext>();
Package::get_functionno longer has a type parameter for the context type. (#274)
// Roto 0.9.0
let f = pkg.get_function::<MyContext, fn(i32) -> i32>();
// Roto 0.10.0
let f = pkg.get_function::<fn(i32) -> i32>();
- Calling a
TypedFuncwithout a context no longer requires the annoying first
argument&mut (). (#274)
// Roto 0.9.0
let f = pkg.get_function::<(), fn(i32) -> i32>();
f.call(&mut (), 5)
// Roto 0.10.0
let f = pkg.get_function::<fn(i32) -> i32>();
f.call(5)
- Similarly, the
Package::run_testsmethod no longer takes an argument if there is no context argument.
// Roto 0.9.0
pkg.run_tests(());
// Roto 0.10.0
pkg.run_tests();
Added
- It’s now possible to register associated constants. (#292)
let lib = library! {
type MyType = Val<MyType>;
impl Val<MyType> {
/// Associated constant FOO!
const FOO: usize = 0;
}
}
- The
RotoFunctrait is now exposed. (#299) - The
selinux-fixfeature flag is added to allow running Roto under SE Linux
systems. This might become the default behaviour in the future. Thanks
@LevitatingBusinessMan! (#279)
Bug fixes
- Fixed a bug which prevented registering types in a module. (#315)
- The
library!macro will emit more precise errors when it fails to parse. (#306) - The
library!macro will be more precise in reporting the actual problems
when trait resolution fails on the generated code. (#318) - Tests are now sorted before being run. (#319)
- We removed some unused dependencies from our dependency tree, though this only
concerned dev-dependencies. (#337)
Documentation
- Documentation was extended and improved a lot in many PRs.