Consilidating Spring Config with Groovy New and improved My Yahoo!
Sep 27

Information on Java Closures from Guy Steele of Sun

Tech Add comments

This thread gives us an insight into why full closures aren’t currently in Java:

> Actually, the prototype implementation *did* allow non-final
> variables to be referenced from within inner classes. There was
> an outcry from *users*, complaining that they did not want this!
> The reason was interesting: in order to support such variables,
> it was necessary to heap-allocate them, and (at that time, at least)
> the average Java programmer was still pretty skittish about heap
> allocation and garbage collection and all that. They disapproved
> of the language performing heap allocation “under the table” when
> there was no occurrence of the “new” keyword in sight.

I find this very ironic. It is too bad that programmers who do not use
Java *because* it doesn’t have closures were not asked about this
issue, instead of those programmers who were already willing to make
such a compromise. This decision insured that this potential new
audience’s desires will not be met.

Interesting indeed. I do hope that in the future people are polled again on their usefulness. A lot of us were C/C++ programmers when we started on the Java bandwagon and were really worried about the heap and such.

Now many of us have moved on and have gotten into languages such as Ruby/Groovy/insert your favorite and have been able to evolve our thinking.

(Of course, some of us were LISPers from way back, and this was, like, duh :)

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'ajax'