help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Error handling/checking, exceptions in general


From: Peter Schuller
Subject: [Help-smalltalk] Error handling/checking, exceptions in general
Date: 21 Dec 2002 04:27:13 +0100

Hello,

how do I ascertain wheather a Socket has successfully connected to the
other end?

At first I figured #isPeerAlive would do it, but it doesn't.

For example, the following code:

        | socket |
        socket := TCP Socket remote: 'somehost' port: somePort.
        socket isPeerAlive inspect.
        !

Yields true. 

The only way I can see is to try to send something and flush it... which
isn't very nice.

And btw, in general. Suppose I came up with a few patches for improving
the exception hierarchy and error handling in general, would it be of
interest? I'm not saying I will because I can't promise that, but if I
were.

All Smalltalks seem to have a problem in this regard. For example, how
do you differentiate from an actual "expected" exception due to network
difficulties from a program bug? There really is no clear way of knowing
which exceptions will be signaled under which circumstances.

I would like to be able to do something like:

[ ... do some network i/o ... ]
        on: NetworkException
        do: [ ... ].

The key point here is that any other exceptions would not be caught.
Same thing goes for other situations.

This requires a proper exception hierarchy and documentation of what
exceptions may be thrown and in which circumstances.

Again, I am not promising anything. But if I do get around to working on
something like that, I'd want it to be well received - I don't want to
create a private GNU Smalltalk fork...

If you've used Java, that's pretty  much the type of thing I'm after.
Exception handling as a language feature is no where near as powerful as
in Smalltalk, but the exception hiearchy and *use* of it in Java is soo
much better IMO than in any Smalltalk. Originally coming from Java, this
is something I would like to work in.

-- 
/ Peter Schuller, InfiDyne Technologies HB

PGP userID: 0xE9758B7D or 'Peter Schuller <address@hidden>'
Key retrival: Send an E-Mail to address@hidden
E-Mail: address@hidden Web: http://www.scode.org







reply via email to

[Prev in Thread] Current Thread [Next in Thread]