Tags: NLnetLabs/roto
Tags
Release 2025-01-29.
- Filter maps no longer have a `define` and an `apply` block. `let` bindings
should be used instead. For example:
```roto
filter-map foo() {
define {
x = 4;
}
apply {
accept x;
}
}
filter-map foo() {
let x = 4;
accept x;
}
```
- Variables can now be created in more places with `let` bindings. `let`
bindings replace the `define`/`apply` mechanism and are much more general
because they can be used in any block. For example, inside functions or
`if`-`else` blocks. The binding is scoped until the end of the block it is
defined in. It is not allowed to declare multiple variables with the same
name within a single block.
- The `String` type was added to represent pieces of text. String literals
are enclosed in double quotes (`"`).
- It is now possible to declare constants in the runtime for a Roto script.
- Similarly, it is now possible to add "context" to Roto scripts. The variables
in the context behave like constants, but they can differ between different
calls to a script. In other words, constants are defined when the script is
_compiled_, context is defined when the script is _run_.
- 64-bit numbers (i.e. `i64` and `u64`) were not type checked and compiled
properly. They are now fixed.
PreviousNext