I’ve just implemented the derivative example from http://en.wikipedia.org/wiki/First-class_function in Java with anonymous classes, and I’m now prepared to admit that the current syntax is clear and perfect, while adding first class functions would probably make our collective heads asplode.
interface Fun {
public double fun(double v);
}
interface HighFun {
public Fun hiFun(Fun f, double v);
}
public class DerivativeFun {
public static void main(String[] args) {
Fun cos = new HighFun() {
@Override
public Fun hiFun(final Fun f, final double dx) {
return new Fun(){
@Override
public double fun(double x) {
return (f.fun(x+dx) - f.fun(x)) / dx;
}
};
}
}.hiFun(new Fun(){
@Override
public double fun(double v) {
return Math.sin(v);
}
}, 0.000000001);
System.out.println("cos(0) = " + cos.fun(0));
System.out.println("cos(PI/2) = " + cos.fun(Math.PI / 2));
}
}
What a refreshing change from Javascript / Scala / C#.
Now, this is admittedly a contrived example… and far from usable (I leave making it generic as an exercise to the reader ;)). It also doesn’t actually get the closure thing to happen properly, in fact I don’t see how that’s possible in this case without inventing a special double wrapper class and doing the maths on that with special methods or something, since mutating a primitive referred to in several places won’t happen.
Please someone point out what I’m missing here.
What’s clean and minimal about that? Just make functions first class types and they can fit consistently with the rest of the syntax. I admit that the # and use of annotation do smell a bit fishy.
The thing is, it seems simplicity in one dimension frequently entails complexity in another; make an operating system appear* simple to use, you often need to introduce more sophisticated technology to facilitate it.
To make a programming language able to express certain things neatly at a high level, it can serve to complicate the language. Of course great care needs to be taken to prevent this from backfiring… but I don’t think avoiding closures is an example where they’re better off being left out.
IMHO it’s just the nature of progress that we build higher level abstractions, which tends to have the effect of hiding exponentially increasing amounts of complexity. When these levels are hidden behind an abstraction, then there’s the chance of the underlying implementation being improved while the interface remains identical.
Personally, I’d love to see something like LINQ in Java (provided it was well implemented)… but at least I can appreciate that really would complicate the syntax.
If you really want a simple, consistent, syntax… you could always use Lisp (maybe Clojure). 
- [EDIT: I had accidentally inserted the word ‘appear’ in the middle of ‘operating system’, rather than after…]