|
If that's the case then Java already has closures. We don't need it. I don't see the value of complicating the language for a feature we already have. I'm sorry it's too hard to implement inner classes.. but I don't think it's worth changing right now.
Apache commons-collections already has cool functions like the select, collect, reject smalltalk had. If you want to add those to the Java library.. fine! But I don't see the need for a new language feature if all its going to be is syntactic sugar.
If we MUST do it then just make it a simpler syntax for annonymous classes but now new sorts of declarations. Ex:
// instead of
addActionListener(new ActionAdapter() {
public void actionPerformed(Event evt) {
...
}
);
// make it (w/o adding new weird declarations)
addActionListener(
new ActionAdapter.actionPerformed(Event evt) {
....
});
Still just as ugly though. Are closures even cool in a statically typed language? |