Cuting Errors

Stephane Ducasse ducasse at
Wed Jan 8 19:12:20 UTC 2003

Hi ned

What I'm trying to do is to avoid that a kid or novices get flooded
by popup window when an error occurs. I want to have error because
I want that they realize that they should test before doing something
but I do not want them to get bored. In fact when if I do not succeed 
to do
what I want I will use error: and tell them to use abandon. Because 
this is exactly
what I want but with no button and stack displayed.

Ok I will look at the handler. I never did that before do you know 
where I can find an example.


On Wednesday, January 8, 2003, at 07:12 PM, Ned Konz wrote:

> On Wednesday 08 January 2003 09:35 am, Stephane Ducasse wrote:
>> Hi
>> 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?
> -- 
> Ned Konz
Dr. Stéphane DUCASSE (ducasse at
  "if you knew today was your last day on earth, what would you do
  different? ... especially if, by doing something different, today
  might not be your last day on earth" Calvin&Hobbes

More information about the Squeak-dev mailing list