<div dir="auto"><div>You are correct</div><div dir="auto"><br></div><div dir="auto">> As a side note, generally I'm a bit disappointed</div><div dir="auto">> from the state of</div><div dir="auto">> exceptions with generics in Java</div><div dir="auto"><br></div><div dir="auto">I recommend reading what I said in the Amber list (the second link I posted few messages ago on this thread), I gave an example of how it is useful, and how union types will be harmful in the generic level without some destructive pattern.</div><div dir="auto"><br></div><div dir="auto">The interfaces I suggested are the best we can do as of today with either uniform Monadic type for exceptions, or better Polymorphic Effects (and if you read my messages from the amber list you would find some my reasoning to think the Polymorphic Effects are better)</div><div dir="auto"><br></div><div dir="auto">I think that adding those new interfaces will encourage more use of exceptions in lambdas which in turn push forward the discussion of finally addressing this monster called error handling in a more uniform consistent way</div><div dir="auto"><br></div><div dir="auto"><br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Thu, Apr 13, 2023, 15:05 Glavo <<a href="mailto:zjx001202@gmail.com">zjx001202@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Unfortunately, such an interface is not good enough for functions that may throw multiple types of exceptions.<br><div><br></div><div>It would be great if Java supports using union types in more places.<br></div><div><br></div><div>Glavo</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 13, 2023 at 7:41 PM Holo The Sage Wolf <<a href="mailto:holo3146@gmail.com" target="_blank" rel="noreferrer">holo3146@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><p style="margin:0px 0px 1.2em">I want to add an argument to push more the j.u.f.exceptionally approach I suggested.</p>
<p style="margin:0px 0px 1.2em">Just today someone in Reddit pointed out how String Templates have an inconsistent semantics with the j.u.function package, as they have the interface:</p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248);display:block">    <span>@FunctionalInterface</span>
    <span style="color:rgb(51,51,51);font-weight:bold">public</span> <span><span style="color:rgb(51,51,51);font-weight:bold">interface</span> <span style="color:rgb(68,85,136);font-weight:bold">Processor</span><<span style="color:rgb(68,85,136);font-weight:bold">R</span>, <span style="color:rgb(68,85,136);font-weight:bold">E</span> <span style="color:rgb(51,51,51);font-weight:bold">extends</span> <span style="color:rgb(68,85,136);font-weight:bold">Throwable</span>> </span>{
        <span>R <span style="color:rgb(153,0,0);font-weight:bold">process</span><span>(StringTemplate st)</span> <span style="color:rgb(51,51,51);font-weight:bold">throws</span> E</span>;
    }
</code></pre>
<p style="margin:0px 0px 1.2em">If we had a j.u.f.exceptionally package, then not only it will be more consistent across the the standard library, it will unify a lot of functional interfaces:</p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248);display:block"><span style="color:rgb(51,51,51);font-weight:bold">import</span> java.util.function.exceptionally.Function;
[...]
    <span>@FunctionalInterface</span>
    <span style="color:rgb(51,51,51);font-weight:bold">public</span> <span><span style="color:rgb(51,51,51);font-weight:bold">interface</span> <span style="color:rgb(68,85,136);font-weight:bold">Processor</span><<span style="color:rgb(68,85,136);font-weight:bold">R</span>, <span style="color:rgb(68,85,136);font-weight:bold">E</span> <span style="color:rgb(51,51,51);font-weight:bold">extends</span> <span style="color:rgb(68,85,136);font-weight:bold">Throwable</span>> <span style="color:rgb(51,51,51);font-weight:bold">extends</span> <span style="color:rgb(68,85,136);font-weight:bold">Function</span><<span style="color:rgb(68,85,136);font-weight:bold">StringTemplate</span>, <span style="color:rgb(68,85,136);font-weight:bold">R</span>, <span style="color:rgb(68,85,136);font-weight:bold">E</span>> </span>{
        <span>R <span style="color:rgb(153,0,0);font-weight:bold">apply</span><span>(StringTemplate st)</span> <span style="color:rgb(51,51,51);font-weight:bold">throws</span> E</span>; <span style="color:rgb(153,153,136);font-style:italic">// luckily, the semantics of the word "apply" also fits for activating a processor</span>
    }
</code></pre>
<div title="MDH:SSB3YW50IHRvIGFkZCBhbiBhcmd1bWVudCB0byBwdXNoIG1vcmUgdGhlIGoudS5mLmV4Y2VwdGlv
bmFsbHkgYXBwcm9hY2ggSSBzdWdnZXN0ZWQuPGRpdj48YnI+PC9kaXY+PGRpdj5KdXN0IHRvZGF5
IHNvbWVvbmUgaW4gUmVkZGl0IHBvaW50ZWQgb3V0IGhvdyBTdHJpbmcgVGVtcGxhdGVzIGhhdmUg
YW4gaW5jb25zaXN0ZW50IHNlbWFudGljcyB3aXRoIHRoZSBqLnUuZnVuY3Rpb24gcGFja2FnZSwg
YXMgdGhleSBoYXZlIHRoZSBpbnRlcmZhY2U6PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5gYGBq
YXZhPC9kaXY+PGRpdj4mbmJzcDsgJm5ic3A7IEBGdW5jdGlvbmFsSW50ZXJmYWNlPGJyPiZuYnNw
OyAmbmJzcDsgcHVibGljIGludGVyZmFjZSBQcm9jZXNzb3ImbHQ7UiwgRSBleHRlbmRzIFRocm93
YWJsZSZndDsgezxicj4mbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgUiBwcm9jZXNzKFN0cmlu
Z1RlbXBsYXRlIHN0KSB0aHJvd3MgRTs8YnI+Jm5ic3A7ICZuYnNwOyB9PGJyPjwvZGl2PjxkaXY+
YGBgPC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5JZiB3ZSBoYWQgYSBqLnUuZi5leGNlcHRpb25h
bGx5IHBhY2thZ2UsIHRoZW4gbm90IG9ubHkgaXQgd2lsbCBiZSBtb3JlIGNvbnNpc3RlbnQgYWNy
b3NzIHRoZSB0aGUgc3RhbmRhcmQgbGlicmFyeSwgaXQgd2lsbCB1bmlmeSBhIGxvdCBvZiBmdW5j
dGlvbmFsIGludGVyZmFjZXM6PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5gYGBqYXZhPC9kaXY+
PGRpdj5pbXBvcnQgamF2YS51dGlsLmZ1bmN0aW9uLjx3YnI+ZXhjZXB0aW9uYWxseS5GdW5jdGlv
bjs8L2Rpdj48ZGl2PlsuLi5dPC9kaXY+PGRpdj4mbmJzcDsgJm5ic3A7IEBGdW5jdGlvbmFsSW50
ZXJmYWNlPGJyPiZuYnNwOyAmbmJzcDsgcHVibGljIGludGVyZmFjZSBQcm9jZXNzb3ImbHQ7Uiwg
RSBleHRlbmRzIFRocm93YWJsZSZndDsgZXh0ZW5kcyBGdW5jdGlvbiZsdDtTdHJpbmdUZW1wbGF0
ZSwgUiwgRSZndDsgezxicj4mbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgUiBhcHBseShTdHJp
bmdUZW1wbGF0ZSBzdCkgdGhyb3dzIEU7IC8vIGx1Y2tpbHksIHRoZSBzZW1hbnRpY3Mgb2YgdGhl
IHdvcmQgImFwcGx5IiBhbHNvIGZpdHMgZm9yIGFjdGl2YXRpbmcgYSBwcm9jZXNzb3I8YnI+Jm5i
c3A7ICZuYnNwOyB9PGJyPjwvZGl2PjxkaXY+YGBgPC9kaXY+PGRpdj48YnI+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px"></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 13, 2023 at 2:30 PM Holo The Sage Wolf <<a href="mailto:holo3146@gmail.com" target="_blank" rel="noreferrer">holo3146@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">>

Do you have a way to help me find that Amber discussion?<div><br></div><div>Here is the start of the thread: <a href="https://mail.openjdk.org/pipermail/amber-dev/2023-March/007849.html" target="_blank" rel="noreferrer">https://mail.openjdk.org/pipermail/amber-dev/2023-March/007849.html</a></div><div><br></div><div>But the relevant part (the discussion I had with Brian Goetz) starts here: <a href="https://mail.openjdk.org/pipermail/amber-dev/2023-March/007858.html" target="_blank" rel="noreferrer">https://mail.openjdk.org/pipermail/amber-dev/2023-March/007858.html</a></div><div><br></div><div>The end conclusion was what you probably expect it to be, but I think it is important discussion to have and I hope that when few features will finally finalize and there will be a bit of free time to the team the discussion will start to be active again </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 13, 2023 at 1:45 PM Andrew Haley <<a href="mailto:aph-open@littlepinkcloud.com" target="_blank" rel="noreferrer">aph-open@littlepinkcloud.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 4/13/23 11:23, Holo The Sage Wolf wrote:<br>
> As a side note, generally I'm a bit disappointed<br>
<br>
You and everybody else.<br>
<br>
> from the state of<br>
> exceptions with generics in Java, not too long ago I talked about it in (I<br>
> believe) the Amber mailing list about possible improvements in the future.<br>
<br>
I've spent a fair bit of time discussing this kind of thing with Brian Goetz<br>
et al., and it's just a very hard problem. Any "Hey, let's do this!" probably<br>
will have some unfortunate side effects somewhere.<br>
<br>
Do you have a way to help me find that Amber discussion?<br>
<br>
-- <br>
Andrew Haley  (he/him)<br>
Java Platform Lead Engineer<br>
Red Hat UK Ltd. <<a href="https://www.redhat.com" rel="noreferrer noreferrer" target="_blank">https://www.redhat.com</a>><br>
<a href="https://keybase.io/andrewhaley" rel="noreferrer noreferrer" target="_blank">https://keybase.io/andrewhaley</a><br>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671<br>
<br>
</blockquote></div><br clear="all"><div><br></div><span>-- </span><br><div dir="ltr"><div dir="ltr">Holo The Wise Wolf Of Yoitsu</div></div>
</blockquote></div><br clear="all"><div><br></div><span>-- </span><br><div dir="ltr"><div dir="ltr">Holo The Wise Wolf Of Yoitsu</div></div>
</blockquote></div>
</blockquote></div></div></div>