8 ms·
In my language (neat, but don't use it yet, it's pre-alpha), you can propagate error types by picking out the valid return type. For instance, if a function ret
by FeepingCreature 5y ago
In my language (neat, but don't use it yet, it's pre-alpha), you can propagate error types by picking out the valid return type. For instance, if a function returns `(string | ErrorType) foo()`, you can declare a result variable as `string a <- foo();` ("pick `string a` from `foo()`") and it will automatically do "if (error) return error;" to handle the other case.
Go could easily do that too if it weren't as afraid of "complex" features.