Strawperson code style/convention changes
Declaring return vars in the function signature
We should either always declare return variables in the return signature, or never do so. Slight preference to "never", since it makes it less obvious not seeing them inline to the function/method.
If we do use them, the return statement should use them
Error handling
Creating a single expression that assigns err
, and evaluates it eliminates a bit of boilerplate, and looks more like the exception handling we see elsewhere. If any of the return values is needed outside the scope of the expression, then it needs to be declared ahead of time (type inference can't be used here). This usually contributes to readability though (explicit v implicit) by making scope more obvious.