From fefc4775a95b7b8c68a514f904ac9a7ecd9c84f1 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 11 Dec 2024 00:46:57 +0800 Subject: 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. --- language_description.md | 10 ++++++---- 1 file 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); -- cgit v1.2.3