Casper Bang wrote: > True, but I don't think many are aware of this. Hmm.... I've used {...} liberally for scoping in Java and C++ since I first used C++. It's one reason I consider C unusable even compared to C++'s and despite C++'s sins. > The JDK7 proposal by > Joshua Bloch specifically adds the multi-scoping aspect over the > existing C# implementation, which only allows multi-scoping of the > same type. > > Constructs that minimizes variable leakage into scope space (temporary > variables) appeals somewhat to me, something Lombok can't possible > address without an ElementType.TYPE_BLOCK. > > I assume this is also a major reason why certain well known people on > the Coin mailing-list claim this should be handled in the language > rather than by annotations. There's a profound fear of the misuse of > annotations, though personally I consider annotation DSL burial (JPA) > way more abusive than say Lombok. > Annotations whiich produce language-like effects, i.e. changes in the byte code (not just metadata) for the class in question is a slippery slope. The extreme cases would generally seem to be a bad thing -- though it is the only way we have to (relatively) cheaply get something like Lombok right now.
There's a /huge /aversion to new keywords at this point and something like try InputStream in = new FileInputStream(path); just doesn't look right. Something like auto InputStream in = new FileInputStream(path); might, but it's still a new keyword. Overall, however, the point is that to eliminate the need for {...} bracketing where it is otherwise unnecessary, e.g.: auto Foo foo = new Foo(); auto Bar bar = new Bar(); auto Baz baz = new Baz(); // code using vars here ... rather than (in the one true bracing style): try ( Foo foo = new Foo() ) { try ( Bar bar = new Bar() ) { try ( Baz baz = new Baz() ) { // code using vars here ... } } } or even try ( Foo foo = new Foo() ) { try ( Bar bar = new Bar() ) { try ( Baz baz = new Baz() ) { // code using vars here ... } } } -- Jess Holle --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---