aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-11 00:46:57 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-11 00:46:57 +0800
commitfefc4775a95b7b8c68a514f904ac9a7ecd9c84f1 (patch)
treecc0fcf04d9a74b0c5df84190c66b5fbc42f981e2
parentUse e² instead of $e^2$ (diff)
downloade2-spec-fefc4775a95b7b8c68a514f904ac9a7ecd9c84f1.tar.gz
e2-spec-fefc4775a95b7b8c68a514f904ac9a7ecd9c84f1.tar.zst
e2-spec-fefc4775a95b7b8c68a514f904ac9a7ecd9c84f1.zip
Error propagation clarification
return in the error block just feels wrong... Also let's just use func syntax to define functions for now, it's also easier to grep this way. Could change this later if really desired.
-rw-r--r--language_description.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/language_description.md b/language_description.md
index b90d031..147db22 100644
--- a/language_description.md
+++ b/language_description.md
@@ -131,8 +131,10 @@ operation and has not been handled at an inner `on_overflow`.
## Error propagation
+We're still clearing up the syntax to allow for more flexibility here.
+
```e2
-(int x, char y) do_stuff() {
+func do_stuff() (int x, char y) {
...
return 0, 1; // Not an error
...
@@ -144,13 +146,13 @@ operation and has not been handled at an inner `on_overflow`.
} on_fail {
return 0, 9; // Another error
} error {
- // Consider it an error if (and only if) the 2nd return value is >= 3
- return y >= 3;
+ // Consider it an error iff the 2nd return value (named "y") is >= 3
+ error_if y >= 3;
}
```
```e2
-int f() {
+func f() int {
// If do_stuff() errored, return ENOCONN
int a, char b = do_stuff()!(ENOTCONN);