Error Messages
Error messages can be implemented via a concept called "Scope Attributes".
Scope Attributes allow the definition of code blocks via the with_attr
statement.
Only local variables can be accessed within the new code block. String interpolation of local variables is possible via {}
.
Example
func main():
alloc_locals
local x = 1
# Error messages will be shown in the standard output during the program's runtime.
with_attr error_message("The value of `x` should be 42 but it's {x}."):
assert x = 42
end
return ()
end