File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion 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: 104
  • 0
  • 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
  • 0
  • 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