September 2009

« August 2009 | Main Index | Archives | October 2009 »

25
Sep

  • Return time machine to rightful owner.

Woke up this morning to found the entire city shrouded in creepy orange fog. These photos are not corrected in any way, the colours are exactly as they came off the camera.

‘They’ are trying to keep us calm by telling us it's a dust storm, but I'm not so sure…

Next day, the dawn was a brilliant, fiery red and I wandered through the weird and lurid landscape of another planet; for the vegetation which gives Mars its red appearance had taken root on Earth. As Man had succumbed to the Martians, so our land now succumbed to the Red Weed. (*)

Back in 2002, I wrote the following about the proposal for an ‘enhanced for loop’ in Java 1.5.

Foreach takes probably the most common use of Smalltalk blocks, the internal iterator, and creates a syntactic special-case for them. Once again, it's a band-aid solution. Foreach removes the annoying duplicated syntax for the simplest case, but it does nothing to give programmers the chance to remove duplication on the more complex cases.

So it seems now for Java 7, closures having been dropped from the roadmap, it's time to apply the next band-aid. This time the recipient is the next in the line of usual suspects, resource management:

Absent a language change, you must close resources manually. That is why Java’s competitors have automatic resource management constructs (C# has using blocks and C++ has destructors).

Back to me from seven years ago:

Once foreach is implemented, the precedent has been set: whenever the lack of [closures] causes us to lag behind C#, don't fix the underlying problem, work around it with a variant on what we have already.

The funniest part, of course, is that C# 3.0 has had closures (or at least succinct lambda expressions with type inference) since 2007.