This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does Scala compare with other scripting languages on the JVM as regards Exception Handling?

 
Lanny Gilbert
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In some forums, I've read that <insert your JVM language of choice that is not Java here> does away with the ugliness of Java Exception Handling.
Does Scala have a easy to use and elegant method of exception handling?

Thanks!
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lanny,

do you really mean exception handling in general? You still have to or better say should handle exceptional conditions in your applications. But I guess you're talking about the annoying boilerplate code to handle exceptions in Java when you have to deal with I/O resources for example. The usual try-catch-finally all over your code just to read a line of text from a file ;-)

This can be handled far less verbose and more elegant with closures for example. Because Scala comes with support for closures as most other languages on the JVM it can help to simplify exception handling a lot. Not sure if this is what you read but at least it is part of the solution regarding the "ugliness" of exception handling.

Marco
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic