|
|
|
|
|
by SaidinWoT
2845 days ago
|
|
The draft doesn't include any actual examples with multiple returns on a function that uses check internally, but the behavior is fully specified: > A check returns from the enclosing function by returning the result of invoking the handler chain with the error value. > A return statement in a handler causes the enclosing function to return immediately with the given return values. A return without values is only allowed if the enclosing function has no results or uses named results. In the latter case, the function returns with the current values of those results. > A handler chain function takes an argument of type error and has the same result signature as the function for which it is defined. > If the enclosing function has result parameters, it is a compile-time error if the handler chain for any check is not guaranteed to execute a return statement. So any handler defined in ReadFile would be required to return (string, error) or not include a return at all (such that other handlers got their chance to interact with the error). |
|