Away from Exceptions: Errors as Values
Personally, i really like having multiple return values, since being able to give a function multiple inputs but only being able to return a single thing always felt weird - if your require any metadata in a language like Java, then you&#x27;d have to come up with wrapper objects and so on.<p>That said, i really dislike the following from the article:<p><pre><code>  if (error) {
    &#x2F;&#x2F; you can handle the error as you see fit
    &#x2F;&#x2F; you can add more information, end the request, etc.
  }
</code></pre>
To me, that&#x27;s an example of &quot;opt in&quot; error handling, which in my eyes should never be the case. The compiler should force you to handle every exception in some way, or to check for it. My ideal programming language would have no unchecked runtime exceptions of any sort - if accessing a file or something over a network can go wrong in 101 ways, then i&#x27;d expect to be informed about these 101 things when i make the dangerous call.<p>Handling those wouldn&#x27;t necessarily have to be difficult, in the simplest case just wrap it in an implementation specific exception, like InputBufferReadException regardless of whether you&#x27;re working with a file or network logic and let them bubble upwards to the point where you actually handle them properly in some capacity, be it with retry logic or showing a message to user, or letting external calling code handle it.<p>Why? Because whenever you&#x27;re given the opportunity to ignore an exception or you&#x27;re not told about it, someone somewhere will forget or get lazy and as a consequence assumptions will lead to unstable code. If NullPointerExceptions in Java were always forced to be dealt with, we&#x27;d either have nullable types be a part of the language that&#x27;s separate from the non-nullable ones (like C# or TypeScript i think), or we&#x27;d see far more usages of Optional&lt;T&gt; instead of stack traces in our logs in prod, because we wouldn&#x27;t be allowed to compile code like that into an executable otherwise.<p>Of course, that&#x27;s my subjective take because of my experience and things like the &quot;Null References: The Billion Dollar Mistake&quot;: <a href="https:&#x2F;&#x2F;www.infoq.com&#x2F;presentations&#x2F;Null-References-The-Billion-Dollar-Mistake-Tony-Hoare&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.infoq.com&#x2F;presentations&#x2F;Null-References-The-Bill...</a><p>I think languages like Zig already work a bit like that: <a href="https:&#x2F;&#x2F;ziglang.org&#x2F;learn&#x2F;overview&#x2F;#a-fresh-take-on-error-handling" rel="nofollow">https:&#x2F;&#x2F;ziglang.org&#x2F;learn&#x2F;overview&#x2F;#a-fresh-take-on-error-ha...</a>