News for hackers. Stuff that matters.
Re:Java 7: Oracle pushes a first version of closures by RodgerTheGreat on Monday May 31, 2010 @01:52PM (#1393055)
I can see that, but I'd be a lot happier if the new syntax they came up with was more consistent with the rest of the language.

I don't think the current syntax for anonymous classes is 'ridiculous', it's just inconveniently verbose when you only want a single method. If you're implementing a more complex interface, the current method is actually pretty good.

Re:Java 7: Oracle pushes a first version of closures by rictic on Monday May 31, 2010 @04:01PM (#1393341)
It is ridiculous.

Java often completely ignores the design guideline of making the easy things easy and the hard things possible, preferring just to make the hard things possible. Anonymous inner classes with many methods are far less commonly needed than anonymous functions, and it's rare that the program is better served having them inline rather than defined elsewhere anyways.

Five lines and dozens of characters of boilerplate for every anonymous function does come at a cost and is ridiculous.

Re:Java 7: Oracle pushes a first version of closures by orangecat on Tuesday June 01, 2010 @12:55AM (#1394364)
Java often completely ignores the design guideline of making the easy things easy and the hard things possible, preferring just to make the hard things possible.

That's it exactly. My "favorite" example is file I/O. Yes, it's great that I can chain a bunch of InputStream instances together to read encrypted gzipped serialized objects over the network, but it shouldn't be more than one line for the far more common case of reading a file's contents into a string or a byte array.