Cuting Errors

John W. Sarkela sarkela at
Wed Jan 8 20:13:13 UTC 2003

A very important paper on appropriate use of exceptions is found in:

It was written by Juanita Ewing who was part of the team that
designed the exception mechanism that later became the
ANSI exception mechanism. It is a simple well written article
that addresses architectural considerations that the programmer
should bear in mind while writing code.

Can't recommend this paper enough. Also old VSE or Smalltalk/V Mac
manuals that may be lying about disused have a very good chapter
that details the use and operation of the exception mechanism.

:-}> John

On Wednesday, January 8, 2003, at 11:37 AM, Ned Konz wrote:

> On Wednesday 08 January 2003 11:12 am, Stephane Ducasse wrote:
>> 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.
> Quick Google search for 'smalltalk "exception handling"' yielded:
> exceptionhandling.htm
> (Dolphin)
>> Stef
>> 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
>>> GPG key ID: BEEA7EFE
>> 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
> -- 
> Ned Konz

More information about the Squeak-dev mailing list