<br><div class="gmail_quote">2011/4/1 Yoshiki Ohshima <span dir="ltr"><<a href="mailto:yoshiki@vpri.org">yoshiki@vpri.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I don't understand the problem. Let us say we start from the<br>
example in the method:<br>
<br>
--------------------<br>
<div class="im">'Now here''s some Real Progress'<br>
displayProgressAt: Sensor cursorPoint<br>
from: 0 to: 10<br>
during: [:bar |<br>
1 to: 10 do: [:x | bar value: x.<br>
(Delay forMilliseconds: 500) wait]].<br>
</div>--------------------<br>
<br>
and your "algorithm" here would be:<br>
<br>
1 to: 10 do: [:x | "do something here"<br>
(Delay forMilliseconds: 500) wait].<br>
<br>
It is already reasonably decoupled to me, but I take that you want to<br>
keep the "algorithm" really prestine and don't want to have "bar<br>
value: x" call in there, and completely get rid of anything from "do<br>
something here". Is this the case?<br>
<br>
There still have to have some way to tell how much percent of work<br>
done from the "algorithm" to the progress notification mechanism. In<br>
the possible meta approach (which would not be that hard at all), I'd<br>
make an instance variable for the object that represents your<br>
algorithm state, and the algorithm assigns a value to the instance<br>
variable, and the progress bar displayer that is running in a separate<br>
thread looks at the variable periodically and update the screen.<br></blockquote><div><br>You dont really need to convert some temp to instance variables. You can track some current context temp variable value (context of concrete process which executes algorithm).<br>
So you need meta description to specify what peace of code in process context provide progress information<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Note that your algorithm may not be a loop. It is totally legitimate<br>
to write:<br>
<br>
algorithm<br>
self doA.<br>
bar value: 0.33.<br>
self doB.<br>
bar value: 0.66.<br>
self doC.<br>
<br>
where doA, doB, doC are long running computation. So, really generic<br>
way to view the progress of something from outside without the<br>
knowledge of where to look at and how to interpret these values are<br>
not going to fly.<br></blockquote></div><br>It's not problem. We have algorithm:<br><br>MyClass>>algorithm<br>
self doA.<br>
self doB.<br>
self doC.<br><br>And with meta description we can write like:<br><br>Progress for: MyClass>>algorithm when: [:desc |<br> desc for: MyClass>>doB value: 0.33.<br> desc for: MyClass>>doC value: 0.66<br>
]<br><br>And doA/B/C can doing some inner loops which we can track with extra meta descriptions.<br><br><br>