<div class="gmail_quote">On Wed, Feb 4, 2009 at 5:47 PM, Randal L. Schwartz <span dir="ltr">&lt;<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">&gt;&gt;&gt;&gt;&gt; &quot;Julian&quot; == Julian Fitzell &lt;<a href="mailto:jfitzell@gmail.com">jfitzell@gmail.com</a>&gt; writes:<br>
<br>
</div>Julian&gt; You&#39;ve thrown some new terminology in there and I can&#39;t quite work out<br>
Julian&gt; what you&#39;re saying... can you give an example that shows what you mean<br>
Julian&gt; in each case?<br>
<br>
internal = reset an instance var of self<br>
external = remove files from a scratch directory<br>
</blockquote></div><br>But what do you mean by &quot;objects that have been suspended&quot;? Contexts? Or are you talking about back-tracked state?<br><br>I mean, take the example of removing a file from a scratch directory. If you wrote a callback like this:<br>
<br>doSomething<br>&nbsp;&nbsp;&nbsp; file := self createScratchFile.<br>&nbsp;&nbsp;&nbsp; [ self doSomethingWithTheFile.<br>&nbsp;&nbsp;&nbsp; answer := self inform: &#39;The first thing is done&#39;.<br>&nbsp; &nbsp; self doMoreWithTheFile ]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ensure: [ self removeScratchFile ]<br>
<br>You don&#39;t want the ensure block run when you hit the #inform: do you?<br><br>Obviously you need to be careful how you implement your #removeScratchFile method because it could be evaluated more than once that is exactly the same of an implementation without using ensure:<br>
<br>doSomething<br>
&nbsp;&nbsp;&nbsp; file := self createScratchFile.<br>
&nbsp;&nbsp;&nbsp; self doSomethingWithTheFile.<br>
&nbsp;&nbsp;&nbsp; answer := self inform: &#39;The first thing is done&#39;.<br>
&nbsp; &nbsp; self doMoreWithTheFile.<br>
&nbsp;&nbsp;&nbsp; self removeScratchFile<br><br>This just seems like the normal problems associated with mixing the back-button with a combination of backtracked and non-backtracked state. #ensure: doesn&#39;t make it any worse.<br><br>
Julian<br>