The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Smalltalker learns Java - observations

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Smalltalker learns Java - observations Posted: Aug 21, 2003 1:26 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Smalltalker learns Java - observations
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement
Thomas Gagne has some interesting observations about the differences in exception handling in Smalltalk and Java:

I was recently reading about Exceptions in Java and discovered they aren't resumable. You can't pick-up from where an exception was thrown. I began wondering how this might be possible in Java, but it would require a change to Java's syntax--or the language. Why?

Java doesn't support code blocks as objects. New functionality can't be introduced to blocks of code without changing the language itself. try/catch/finally is implemented as part of the language and not as a feature of an object.

Also, because Java as statically typed it would be nearly impossible to resume with a new value anyway since the "throw" command would have to be able to return a value--but since throw is a command it doesn't return values--and even if it did it would have to return the amorphous "object" which would then require down casting to be made useful. Even then it may be impossible to resume processing with an alternative primitive value.

So Java programs have to run while{}s outside their try{}catch{}s to correct something--which makes the granularity of what can be retried fairly large. Meaning, if there are side effects inside try{} they will either need to be reexecutable without additional (bad) effects or whatever they did will require undoing (or inoculation) inside the catch{}.

In Smalltalk, however, interesting features can be added to blocks and exceptions because they're objects, and object's behavior can be extended without subclassing and is possible in the first place because they aren't "final" nor closed in the base library.

Smalltalk is even neater now than it was a few weeks ago.

Read: Smalltalker learns Java - observations

Topic: On not getting it Previous Topic   Next Topic Topic: Something I missed at StS

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use