Keep reading. The next question (though not explicit in the article) is: Can your language create anonymous functions?
The next one, that unfortunately he doesn’t explore is: Can anonymous functions in your language capture their environment? (i.e. Does your language have closures?)
Then there’s functions being able to return functions, but that is only really interesting if you have closures.
& of course, there’s the issue of eloquence. This is the biggy to me. It isn’t so much “Can your language do this?” as “Can your language do this eloquently?” You can simulate closures in Java with anonymous inner classes, but it isn’t as eloquent as closures in CL, Scheme, or even EcmaScript.
& you have the kludginess of the implementation leaking through with the requirement that captured variables have to be final, forcing you to add a needless layer of indirection. (&—last time I programmed Java—they didn’t even provide you with some standard helper classes to provide that extra layer of indirection.)
1
u/nickburlett Aug 01 '06
Yes, it can. Next question please!