<div dir="ltr"><div dir="ltr">On Mon, Nov 14, 2022 at 4:52 PM <<a href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">I'm proposing to demote checked exceptions to make them second class citizen because this practically what they are.<br><div><div>The problem is that the status quo is pushing people to use runtime exceptions instead of exceptions because checked exception do not compose well, exactly what we both do not want.<br></div></div></div></div></blockquote><div><br></div><div>I totally agree that the lack of composibility (composibleness?) is a problem. But I don't agree that ALL of the blame for that problem rests on checked exceptions. After all, checked exceptions have been around a lot longer than lambdas.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><div><div>What if checked exceptions work like unchecked casts ?</div></div></div></div></blockquote><div><br></div>This sounds like a much more promising direction to go in.</div><div class="gmail_quote"><br></div><div class="gmail_quote">All we want is a simple way to tell the compiler "I know this lambda can throw a checked exception, just pass it through instead of making this impossible to compile".</div><div class="gmail_quote"><br></div><div class="gmail_quote">E.g. something like this??<br></div><div class="gmail_quote" style="margin-left:40px"><span style="font-family:monospace"><br></span></div><div class="gmail_quote" style="margin-left:40px"><span style="font-family:monospace">public <T> void execute(<span style="background-color:rgb(255,255,0)">@PassThroughCheckedExceptions</span> Supplier<T> getter) {<br></span></div><div class="gmail_quote" style="margin-left:40px"><span style="font-family:monospace">    return <span style="font-family:monospace">getter</span>.get();<br></span></div><div class="gmail_quote" style="margin-left:40px"><span style="font-family:monospace">}</span></div><div class="gmail_quote" style="margin-left:40px"><span style="font-family:monospace"><br></span></div><div class="gmail_quote" style="margin-left:40px"><span style="font-family:monospace">public InputStream openFile(File file) throws IOException {</span></div><div class="gmail_quote" style="margin-left:40px"><span style="font-family:monospace">    this.execute(FileInputStream::new);<br></span></div><div class="gmail_quote" style="margin-left:40px"><span style="font-family:monospace">}<br></span></div><div><br></div><div>-Archie<br></div><div class="gmail_quote"><div> </div></div>-- <br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>