4 ms·
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 synta
by RodgerTheGreat 16y ago
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.
- rictic 16y agoIt 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.
- orangecat 16y agoJava 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.