- Remove old syntax for quoted blocks, `#quote` and `#()`.
- Switch to `[] {}` and `[] ()` respectively.
- Old WASI specific modules for time and environment variables.
+- `Result.return_err` and `Result.return_ok`.
+ - Unnecessary with new union features.
Changes:
+- Added support for optionals in `json.encode`, `json.from_any`, and `json.as_any`.
Bugfixes:
#inject Result {
- #doc "Quick way to return an Ok from a procedure."
- return_ok :: macro (x: $T) do return .{ Ok = x };
-
- #doc "Quick way to return an Err from a procedure."
- return_err :: macro (x: $T) do return .{ Err = x };
-
#doc "Returns true if the result contains an Ok value."
is_ok :: (r: #Self) {
switch r {
procedure. Otherwise, the Ok value is returned.
f :: () -> Result(i32, str) {
- Result.return_err("Oh no...");
+ return .{ Err = "Oh no..." };
}
g :: () -> Result(str, str) {
v := f()->forward_err();
println(v);
- Result.return_ok("Success!");
+ return .{ Ok = "Success!" };
}
"""
forward_err :: macro (r: Result($T, $E)) -> T {