<br><br><div class="gmail_quote">On Wed, Mar 3, 2010 at 5:30 PM, Gary Chambers <span dir="ltr">&lt;<a href="mailto:gazzaguru2@btinternet.com">gazzaguru2@btinternet.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Certainly a tangled web... of course we want all ensures to happen,<br>
like, I think, any use of terminate to happen too. A conflict of<br>
interest, especially in the case of errors within ensures...<br>
<br>
No easy answer I think. I favour having terminate complete if errors in<br>
ensures, otherwise that ensures complete before eventual termination...<br></blockquote><div><br></div><div>I think it&#39;s vital that an error during termination is reported not silenced.  How are you going to write something correct if errors during termination are hidden?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Regards, Gary<br>
<div><div></div><div class="h5"><br>
<br>
On Thu, 2010-03-04 at 00:56 +0100, Nicolas Cellier wrote:<br>
&gt; 2010/3/4 Levente Uzonyi &lt;<a href="mailto:leves@elte.hu">leves@elte.hu</a>&gt;:<br>
&gt; &gt; On Thu, 4 Mar 2010, Nicolas Cellier wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; 2010/3/3 Levente Uzonyi &lt;<a href="mailto:leves@elte.hu">leves@elte.hu</a>&gt;:<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; On Wed, 3 Mar 2010, Andreas Raab wrote:<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt; On 3/3/2010 2:07 PM, Levente Uzonyi wrote:<br>
&gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;&gt; On Wed, 3 Mar 2010, Igor Stasenko wrote:<br>
&gt; &gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;&gt;&gt; i don&#39;t get it. Just before that, you said: &#39; I&#39;d expect it to be<br>
&gt; &gt;&gt;&gt;&gt;&gt;&gt; evaluated no matter what happens.&#39; ?<br>
&gt; &gt;&gt;&gt;&gt;&gt;&gt; But now you saying that it may not be executed in some conditions<br>
&gt; &gt;&gt;&gt;&gt;&gt;&gt; (when user pressing abandon button, causing process to be terminated).<br>
&gt; &gt;&gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;&gt; It&#39;s simple: don&#39;t terminate process X from another process if process<br>
&gt; &gt;&gt;&gt;&gt;&gt; X<br>
&gt; &gt;&gt;&gt;&gt;&gt; is executing a termiation block (aka #ensure: block). Or if you<br>
&gt; &gt;&gt;&gt;&gt;&gt; terminate it, make sure that the execution of the block will continue<br>
&gt; &gt;&gt;&gt;&gt;&gt; somehow (I don&#39;t care how).<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt; You&#39;re missing Igors point which is that in his example the halt /<br>
&gt; &gt;&gt;&gt;&gt; Transcript *was* in the ensure block and as a result you&#39;re<br>
&gt; &gt;&gt;&gt;&gt; contradicting<br>
&gt; &gt;&gt;&gt;&gt; yourself here. Let&#39;s go back to Igor&#39;s example:<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt; [self boom ] ensure: [ self halt. Transcript show: &#39;boom&#39;]<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt; The halt is inside the ensure block. If you terminate the process from<br>
&gt; &gt;&gt;&gt;&gt; the<br>
&gt; &gt;&gt;&gt;&gt; debugger, it would be logical from your statement that the Transcript<br>
&gt; &gt;&gt;&gt;&gt; message would be executed - after all it&#39;s &quot; executing a termiation<br>
&gt; &gt;&gt;&gt;&gt; block<br>
&gt; &gt;&gt;&gt;&gt; (aka #ensure: block)&quot; and so it can&#39;t be terminated by your reasoning.<br>
&gt; &gt;&gt;&gt;&gt; However, when Igor was pointing this out you replied with &quot;I didn&#39;t say<br>
&gt; &gt;&gt;&gt;&gt; that. I said evaluate it the same way as normal code.&quot; which is<br>
&gt; &gt;&gt;&gt;&gt; inconsistent<br>
&gt; &gt;&gt;&gt;&gt; with the other statement.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; That shows my lack of knowledge about how the debugger works.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;&gt; I think every user of #ensure: expects that the termination blocks are<br>
&gt; &gt;&gt;&gt;&gt;&gt; executed even if the process which is executing the receiver of<br>
&gt; &gt;&gt;&gt;&gt;&gt; #ensure:<br>
&gt; &gt;&gt;&gt;&gt;&gt; is terminated. And it actually happens in all but this case.<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt; The question of terminating processes is always tricky. I don&#39;t think<br>
&gt; &gt;&gt;&gt;&gt; that<br>
&gt; &gt;&gt;&gt;&gt; your proposal would actually work in practice - it could easily result<br>
&gt; &gt;&gt;&gt;&gt; in<br>
&gt; &gt;&gt;&gt;&gt; processes that cannot be terminated due to a simple bug in an ensure<br>
&gt; &gt;&gt;&gt;&gt; block.<br>
&gt; &gt;&gt;&gt;&gt; Personally, I&#39;d rather say that the more useful behavior would be<br>
&gt; &gt;&gt;&gt;&gt; something<br>
&gt; &gt;&gt;&gt;&gt; along the lines of saying that process termination either skips the<br>
&gt; &gt;&gt;&gt;&gt; current<br>
&gt; &gt;&gt;&gt;&gt; ensure block (assuming there&#39;s a bug and it should get the heck out of<br>
&gt; &gt;&gt;&gt;&gt; it<br>
&gt; &gt;&gt;&gt;&gt; but try to evaluate the remaining ones) or that there need to be two<br>
&gt; &gt;&gt;&gt;&gt; terminations - one that is &#39;soft&#39; and won&#39;t allow ensure blocks to be<br>
&gt; &gt;&gt;&gt;&gt; skipped and one that is &#39;hard&#39; (kill -9 hard) and just ignores all the<br>
&gt; &gt;&gt;&gt;&gt; ensure blocks.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; I&#39;m only saying that normal usage (aka #terminate) shouldn&#39;t do<br>
&gt; &gt;&gt;&gt; unexpected<br>
&gt; &gt;&gt;&gt; things like this.<br>
&gt; &gt;&gt;&gt; If you read the comment of Process &gt;&gt; #terminate, you may assume that<br>
&gt; &gt;&gt;&gt; #ensure: and #ifCurtailed: blocks will be excuted even if you use<br>
&gt; &gt;&gt;&gt; #terminate, but that&#39;s not true.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; &quot;Stop the process that the receiver represents forever.  Unwind to<br>
&gt; &gt;&gt;&gt; execute<br>
&gt; &gt;&gt;&gt; pending ensure:/ifCurtailed: blocks before terminating.&quot;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; Levente<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; The only way I see to solve your problem would be to execute the<br>
&gt; &gt;&gt; unwind block in another process...<br>
&gt; &gt;&gt; Quite technical and costly !<br>
&gt; &gt;<br>
&gt; &gt; It&#39;s our problem. Just look at the senders of #ensure: and imagine what will<br>
&gt; &gt; happen if the termination block is not evaluated.<br>
&gt; &gt; I think there&#39;s another way (though it might be my lack of knowledge again).<br>
&gt; &gt; After suspending the process which is about to be terminated we can check if<br>
&gt; &gt; it&#39;s executing a termination block. It it&#39;s not, we are safe to continue the<br>
&gt; &gt; termination, otherwise we can do something else which ensures that the<br>
&gt; &gt; termination block is evaluated.<br>
&gt; &gt;<br>
&gt;<br>
&gt; Maybe...<br>
&gt; Unfortunately, you did not tell how you will distinguish well behaved<br>
&gt; unwind-blocks from Igor&#39;s example...<br>
&gt;<br>
&gt; Nicolas<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; Levente<br>
&gt; &gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Nicolas<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt; Cheers,<br>
&gt; &gt;&gt;&gt;&gt;  - Andreas<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt;<br>
<br>
<br>
<br>
</div></div></blockquote></div><br>