ned at bike-nomad.com
Wed Jan 8 18:12:11 UTC 2003
On Wednesday 08 January 2003 09:35 am, Stephane Ducasse wrote:
> I implementing a small bot that should popup a window when pumping
> into walls (a kind of error). Moreover, when I have a loop I only
> want to have one window showing up.
> b1 := Bot new.
> 4 timesRepeat: [b1 go].
> I should get only one window and not 4.
> In fact I generated an error then caught it and I started to look
> around to see how I can walk up in the execution stack until I
> arrived to the first expression.
> Right now this is a nice idea but it does not work.
> Does anybody have an example on how to walk into a method context
> until a certain point?
> And kill it?
> Does somebody already have to implement similar behavior?
I'm not altogether sure what you're trying to do, but this is
typically handled by exception handlers.
Do you mean that the 4x loop should be terminated upon the first wall
bump? Or merely that for any number of bumps you should only have a
single window open?
Of course, you can have handlers at various depths in the stack. And
you can re-throw an exception as another kind if you want.
I'd install an exception handler at the topmost level (of course), as
well as one at each level where you want separate handling.
Does "go" run in the same Process or does it fork another one?
GPG key ID: BEEA7EFE
More information about the Squeak-dev