4 ms·
> If your function doesn't throw errors now, but does in the future, that's an API breakage. So what you're saying is that, to avoid future API breakages, you
by Will_Parker 9y ago
> If your function doesn't throw errors now, but does in the future, that's an API breakage.
So what you're saying is that, to avoid future API breakages, you should include an error result in every non-trivial function, and probably the trivial ones too in case a changing spec makes the behavior not so trivial anymore.
- zaarn 9y agoIt's a bit silly to avoid API breakages by always returning a nil error. If a function is changed to now return an error, it's API breakage. I would consider it a breakage if it previously return just nil or not since the previous "always nil" is documented or implicitly contracted as part of the API.