exception handling lingo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

exception handling lingo

Mark Volkmann
I asked this earlier, but it wasn't the first question in my email, so  
it may have been overlooked.

In Smalltalk lingo is it correct to say "signal" and "handle" in place  
of Java's "throw" and "catch"?

---
Mark Volkmann




_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: exception handling lingo

Nicolas Cellier-3
Mark Volkmann a écrit :
> I asked this earlier, but it wasn't the first question in my email, so
> it may have been overlooked.
>
> In Smalltalk lingo is it correct to say "signal" and "handle" in place
> of Java's "throw" and "catch"?
>
> ---
> Mark Volkmann

He, nobody answering, seems you reached some kind of quota ;)

I would say, you mostly get it, but:
- in java/C++ etc... throw/catch try/catch are part of Syntax
- in Smalltalk, these are just ordinary messages sent to objects...

As such, you'll see some differences across dialects like #raise instead
of #signal for example...
Inside a Smalltalk dialect, you'll see also some variations (browse
usage of #signal: in Squeak for example).

Concerning #handle, i don't know where you get the information...
#handle:do: is a compatibility message dating from very old Visualworks
image and is not in Squeak images, AFAIK.
ANSI recommend using #on:do:
Also browse usage of simpler messages like #ensure: #ifCurtailed:

Also browse all possible handling actions like #reject #pass #retry
#return #retryWith: #return: #resignalAs:
Maybe you'll need some good tutorial to learn the differences between
these actions (remember that Smalltalk can handle the MethodContext call
stack, so don't be amazed of rich possibilities there).

Cheers

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Re: exception handling lingo

Michael van der Gulik-2


On Wed, Oct 1, 2008 at 7:34 AM, nicolas cellier <[hidden email]> wrote:
Mark Volkmann a écrit :
I asked this earlier, but it wasn't the first question in my email, so it may have been overlooked.

In Smalltalk lingo is it correct to say "signal" and "handle" in place of Java's "throw" and "catch"?

---
Mark Volkmann

He, nobody answering, seems you reached some kind of quota ;)


Nah. Mark: don't stop asking questions; I've learned stuff myself from some of the answers. If you haven't already, jump on IRC (Freenode, #squeak) and ask stuff there too.

I'm not sure there's a common lingo in the community for talking about exceptions. Personally, I haven't used them as much as I should and I think that applies to most Smalltalkers.

"signal" can be a bit confusing because we also signal semaphores.

Gulik.

--
http://people.squeakfoundation.org/person/mikevdg
http://gulik.pbwiki.com/

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Re: exception handling lingo

Mark Volkmann
In reply to this post by Nicolas Cellier-3
On Sep 30, 2008, at 1:34 PM, nicolas cellier wrote:

> Mark Volkmann a écrit :
>> I asked this earlier, but it wasn't the first question in my email,  
>> so it may have been overlooked.
>> In Smalltalk lingo is it correct to say "signal" and "handle" in  
>> place of Java's "throw" and "catch"?
>> ---
>> Mark Volkmann
>
> He, nobody answering, seems you reached some kind of quota ;)
>
> I would say, you mostly get it, but:
> - in java/C++ etc... throw/catch try/catch are part of Syntax
> - in Smalltalk, these are just ordinary messages sent to objects...
>
> As such, you'll see some differences across dialects like #raise  
> instead of #signal for example...
> Inside a Smalltalk dialect, you'll see also some variations (browse  
> usage of #signal: in Squeak for example).
>
> Concerning #handle, i don't know where you get the information...
> #handle:do: is a compatibility message dating from very old  
> Visualworks image and is not in Squeak images, AFAIK.
> ANSI recommend using #on:do:
> Also browse usage of simpler messages like #ensure: #ifCurtailed:
>
> Also browse all possible handling actions like #reject #pass #retry  
> #return #retryWith: #return: #resignalAs:
> Maybe you'll need some good tutorial to learn the differences  
> between these actions (remember that Smalltalk can handle the  
> MethodContext call stack, so don't be amazed of rich possibilities  
> there).


Thanks! I think I understand all you said except for two things.

1) The ifCurtailed method. From just looking at the comment in the  
method and the code, I have no idea what it does.

2) The reject method. Which class are you referring to? The ones I see  
that contain that method don't seem related to exception handling.

---
Mark Volkmann




_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Re: exception handling lingo

Bert Freudenberg
In reply to this post by Michael van der Gulik-2

Am 30.09.2008 um 14:12 schrieb Michael van der Gulik:
> Mark: don't stop asking questions; I've learned stuff myself from  
> some of the answers. If you haven't already, jump on IRC (Freenode,  
> #squeak) and ask stuff there too.


Actually, if you're not in a hurry, please prefer the mailing list  
over IRC. Many more people can learn that way.

- Bert -


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: exception handling lingo

Nicolas Cellier-3
In reply to this post by Mark Volkmann
Mark Volkmann <mark <at> ociweb.com> writes:

>
> On Sep 30, 2008, at 1:34 PM, nicolas cellier wrote:
>
>
> Thanks! I think I understand all you said except for two things.
>
> 1) The ifCurtailed method. From just looking at the comment in the  
> method and the code, I have no idea what it does.
>

(execBlock ensure: finiBlock) will execute finiBlock whether an Exception occur
or not while executing execBlock. One typical use in image is to close files.

(execBlock ifCurtailed: finiBlock) will execute finiBlock only if an Exception
occur. Usage is rare.


> 2) The reject method. Which class are you referring to? The ones I see  
> that contain that method don't seem related to exception handling.
>

Sorry, forget it, I'm just mixing the dialects!
Exception>>#reject was a synonym for #pass in early VW pre-ANSI implementation.
I find reject quite expressive though: either I handle the exception or reject
it. If I reject it, the Exception is passed to an upper level (in the call
stack) handling.
I see #pass more as a consequence of my decision to #reject the Exception.
But that's surely an effect of age: old progammers don't like their framework to
change ;).


> ---
> Mark Volkmann
>

And of course, please ask your questions, you are welcome.
The idea of quota was just a joke addressed to this community for not answering
promptly.

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners