<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 5 Jan 2023, at 13:16, Arnaud Masson <<a href="mailto:arnaud.masson@fr.ibm.com" class="">arnaud.masson@fr.ibm.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class="">I prefer the Supplier approach a lot.<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class="">Future usage in StructuredTaskScope looks weird especially since it reintroduces async style “legacy” where we don’t expect it.<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>The original thinking was that:</div>
<div><br class="">
</div>
<div>1. fork returning Future would feel more familiar to programmers acquainted with ExecutorService.submit</div>
<div>2. We didn’t know how important it would be to match exceptions to particular forks. That’s what we're trying to learn now.</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class="">Btw has a safer lambda-oriented API been considered (as an optional static helper)? for example:<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""> var sum = StructuredTaskScope.execute(<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""> () -> task1(),<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""> () -> task2(),<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""> (result1, result2) -> result1 + result2<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""> ) // throws if any error in one of the parallel tasks<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class="">(It could be defined for 2,3,4… args)<o:p class=""></o:p></span></div>
<div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;" class="">
<span lang="EN-US" style="font-size: 11pt;" class=""><o:p class=""> </o:p></span></div>
</div>
</div>
</blockquote>
<br class="">
</div>
<div>Yes. Pretty much any approach you can imagine has been tried. However, libraries are welcome to build convenience methods for common situations on top of STS as they see fit.</div>
<div><br class="">
</div>
<div>— Ron</div>
</body>
</html>