<div class="gmail_quote">On Wed, Feb 4, 2009 at 5:47 PM, Randal L. Schwartz <span dir="ltr"><<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>></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">>>>>> "Julian" == Julian Fitzell <<a href="mailto:jfitzell@gmail.com">jfitzell@gmail.com</a>> writes:<br>
<br>
</div>Julian> You've thrown some new terminology in there and I can't quite work out<br>
Julian> what you're saying... can you give an example that shows what you mean<br>
Julian> 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 "objects that have been suspended"? 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> file := self createScratchFile.<br> [ self doSomethingWithTheFile.<br> answer := self inform: 'The first thing is done'.<br> self doMoreWithTheFile ]<br> ensure: [ self removeScratchFile ]<br>
<br>You don'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>
file := self createScratchFile.<br>
self doSomethingWithTheFile.<br>
answer := self inform: 'The first thing is done'.<br>
self doMoreWithTheFile.<br>
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't make it any worse.<br><br>
Julian<br>