From fefc4775a95b7b8c68a514f904ac9a7ecd9c84f1 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Wed, 11 Dec 2024 00:46:57 +0800 Subject: [PATCH] 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 ++++++---- diff --git a/language_description.md b/language_description.md index b90d031473b46bb7d4bf6317b0225fc8d6018c32..147db22179452103f137504cf8310d5c30a956a5 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 @@ return -5, 3; // Some other error } 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); -- 2.48.1