Bearded Magnum

Ruby is great

leave a comment

or “Closures are great” I should say.

After thousands of Java lines, it’s so sweet to write such simple things as:

Dir.chdir(some_dir){
   puts "do your business here"
}

instead of:

actual = Dir.pwd
Dir.chdir(some_dir)
puts "do your business here"
Dir.chdir(actual)

As of today, closures are not available in Java. A JSR proposal may be included in Java7. Alex Miller maintains a good summary of what’s going on about Closures in Java7.
If you want to know more about Closures and Java, another Miller wrote a nice post few years ago.

Written by Alexis

August 24th, 2007 at 4:33 am

Posted in Uncategorized