<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 13 Apr 2023 at 18:50, Ville Voutilainen &lt;<a href="mailto:ville.voutilainen@gmail.com">ville.voutilainen@gmail.com</a>&gt; 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 Fri, 14 Apr 2023 at 00:44, Edward Catmur &lt;<a href="mailto:ecatmur@googlemail.com" target="_blank">ecatmur@googlemail.com</a>&gt; wrote:<br>
<br>
&gt;&gt; Warning users that these things don&#39;t work in coroutines seems like a<br>
&gt;&gt; palatable solution to me.<br>
&gt;<br>
&gt;<br>
&gt; It seems like a non-solution to me. Users will do it anyway, then get confused and complain when it doesn&#39;t work. Coroutine libraries will come up with solutions like the above, but independently and without interoperability, so if you&#39;re using the folly scope guards you have to use folly coroutines and vice versa, and the same for boost etc.<br>
&gt;<br>
&gt; The thing is, it is possible for scope guard destructors to detect how they were called. We just have to give up composability, which honestly doesn&#39;t seem like that much of an issue - why would you want to put a scope guard inside another object or in dynamic storage?<br>
<br>
To give RAII semantics to types that don&#39;t have them internally,<br>
without having to write holder types. If that&#39;s the price of getting<br>
coroutines to work, to lose the ability to do that, then you can burn<br>
coroutines for all I care.<br></blockquote><div><br></div><div>If it&#39;s for RAII, then plain scope_guard should be fine (even if a bit misused; a class type is not a scope). scope_success and scope_failure would not make much sense as data members unless you&#39;re writing another success/failure scope guard class (what I meant by composability).</div></div></div>

