September 13, 2004

Closures etc

Martin Fowler provides an succinct summary of Closures with some fairly useful but simple examples. While trying to explain Closures or Higher Order Functions to Java or C developers, one quite often struggles to respond to “oh I can do that using function pointers and/or anonymous inner classes”.

Well, you can’t, not only because you need proper lexical scoping to have real fun, but also because the non-intrusiveness of defining them in the language is as important. However, some of these subtleties may be difficult to grasp without actually writing some code. So the next time you are explaining all this to a Java programmer, and are feeling too lazy to come up with real life examples, point them here.

Posted by aviks at 11:29 AM | Comments (0)