3 ms·
I've run into that as well, but I've since come to favor avoiding that pattern entirely as a code smell. In your example, you end up modifying the struct value
by garfij 10y ago
I've run into that as well, but I've since come to favor avoiding that pattern entirely as a code smell.
In your example, you end up modifying the struct value x, even if there was an error. Maybe there are cases where that is the correct behavior, but even then I would advocate for explicitly setting the struct value after handling the error, to make it very clear that it was your intention to do so, rather than doing it be accident.