At multiple stages in the e-mail delivery process there are opportunities to affect the behavior (e.g. accept or reject an e-mail message). These are referred to as flows, scripts or contexts, each of which extends the language with additional functions and pre-defined variables.
The syntax is inspired by languages such as PHP (e.g.
$variable) and Python (e.g. slices
[0:10]). It’s however not based upon any of these, so in some cases even if the syntax or function name is the same, there may be differences in the behavior hence always refer to this documentation.
Here are some of the internals of Halon Scripting Language (HSL).
HSL code is compiled into a binary representation. This binary representation is reused between executions.
As a step in the compilation progress, different optimizations are applied. Constant folding is one of them where constant mathematical expressions are simplified (evaluated) at compile time.
Code pattern optimizations
HSL tries to detect certain code pattern and replace them with faster alternatives. Eg. while (true) is compiled to the equivalent of forever.
Dead code elimination
HSL tries to detect and remove dead code in the compilation stage.
HSL code may be executed in parallel. Memory may be synchronized using barriers.
HSL features copy-on-write memory, for the data types array and string. Constants’ memory are shared among multiple executions, vastly reducing memory consumption.
R-value expressions are optimized in a folding-style, so that unnecessary memory allocations are avoided.
HSL doesn’t require manual memory management as it features reference counted garbage collection.
HSL is a “dynamically-typed programming language”. Featuring numbers, strings, associative arrays and functions.
Variables are function scoped, in addition to the global scope. Functions are available in all scopes (and registered at compile time). Scoping may be changed with the global keyword.