<div dir="ltr"><div dir="ltr">Em qua., 1 de out. de 2025 às 03:38, Adam Warski <<a href="mailto:adam@warski.org">adam@warski.org</a>> escreveu:</div><div class="gmail_quote gmail_quote_container"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>> Well if scope.join() waits until all forks complete, it will only do so when there are no forks left, and then nobody can create new forks? So I don’t think there’s a race here? In other words, forks can only be created from live forks, before they complete.<br>
> That's right but allowing this (as it was in early previews) creates weirdness where a subtask can fork it cannot join. It also messes with the mental model of "parent".  Who is my parent when I'm forked by a sibling?<br>
> <br>
> If the problem has been arranged so that subtask opens a new scope and decomposes into a set of sub-subtasks forked in this scope, thus creating a hierarchy, then it becomes simpler to reason about.<br>
<br>
Absolutely, if you can correctly solve your problem using nested scopes, that’s the way to go! Full agreement here :)<br>
<br>
However, the forks-in-forks is one solution or work-around for the problem of having complex, or blocking logic in the scope’s body, and wanting that logic to participate in the same error handling (interrupt when scope is cancelled) as the forks.<br>
</blockquote></div><div><br clear="all"></div><div>I fail to understand this; I have not tested STS extensively.</div><div>Is it not the case that an inner scope will be cancelled when its parent scope is cancelled?</div><div>The forked subtask would be joining the inner scope; will this inner join not be cancelled when the outer join is cancelled?</div><div>In what sense does an inner scope not participate in the same error handling as the outer scope?</div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Pedro Lamarão</div></div></div></div>