for local variables, javac actually does almost nothin:it only frees that local variable slot for a future local variable
theres a nice puzzle about that in the java specialists newsletter: http://www.javaspecialists.eu/archive/Issue173.html of course youre not suppose to know its about local variables and javac before seeing the puzzle... On Tue, Sep 1, 2009 at 9:44 PM, Mark Derricutt<m...@talios.com> wrote: > I've always been intrigued by these blocks we have in java, what does javac > actually generate for them? I'd always hoped that the closures proposals > might just start small and make these blocks a first class citizen. > From: > public void test() { > int foo = 1; > { > int bar = foo + 2; > } > //MARK > } > to: > public void test() { > int foo = 1; > Method foobar = { > int bar = foo + 2; > } > foobar.invoke(null); > //MARK > } > *sigh* I want my closures and mixins. > -- > Pull me down under... > > Sent from Auckland, Auk, New Zealand > > On Wed, Sep 2, 2009 at 5:47 AM, Reinier Zwitserloot <reini...@gmail.com> > wrote: >> >> You can put { (statements) } anywhere in java code where a statement >> is legal. Like any other occurrence of {} to delimit code, any >> variable declarations inside the {} are not visible outside the >> brackets. So, this: > > > > > -- http://mapsdev.blogspot.com/ Marcelo Takeshi Fukushima --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javaposse@googlegroups.com To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---