Java closures and threading
My main concern with proposals for closures in Java has always been that it has the potential of making multi-threading so transparent that you forget to think about issues you need to think about, much like happens again and again with mechanisms that make it so transparent to make remote procedure calls that you forget to handle the issues you really need to think about in that scenario.
Rather than write a long story here, I wrote my first blog post ever: http://tobega.blogspot.com/2008/02/java-closures-and-threads.html
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)






Comments
Osvaldo Doederlein replied on Mon, 2008/03/03 - 3:54pm
Torbjörn Gannholm replied on Tue, 2008/03/04 - 3:00am
Osvaldo, programmers are no more stupid than anybody else as stated by Dilberts rule: "Everybody is an idiot sometimes".
It is even more likely that programmers are forgetful sometimes even if they know what they're doing.
You seem to read my post as "no closures" but that is not what I said, I merely stated that there is a weakness in BGGA where threading is concerned. But the CICE proposal has a nice solution for that, shared mutable variables have to be labelled public. The only enhancement I can think of over that would be to by default require that referenced shared objects are immutable.