John: return is a keyword. Making context sensitive keywords is a major change.
Making () optional is an even bigger and more drastic change that's going to run into lots of resistance. But, most importantly: return foobar; would become ambiguous. You lose source backwards compatibility. My personal intuition about the chances of that happening: Between Hell freezing over and Tor making it through an entire posse without coding. On Jan 14, 7:19 pm, "John Nilsson" <[email protected]> wrote: > On Wed, Jan 14, 2009 at 4:43 PM, Reinier Zwitserloot > <[email protected]>wrote: > > > You could graft long returns on > > FCM or CICE later, but once you've already used 'return' for the > > notion of a local return, then a future long return addition can never > > be transparent - you'd have to have a different syntax for returning > > out of the containing block, which all by itself is a pretty big > > negative mark - that would mean that any attempt to add language > > features by way of just writing a utility method are permanently > > crippled by the fact that the 'return' syntax is not transparent, and > > thus the need to know that something is a library call instead of a > > language feature will always be a leaky abstraction. > > There are probably other ways to implement this. If you could, say, call > methods without parenthesis like in Scala, and had a nice way of exposing > those methods to the closure you could implement any behavior you want, and > call it what you want, instead of being restricted to return and friends. > > Implementing long return in this way is just the matter of throwing an > exception and catch it at the right place. > > Something like > > abstract class ControlClosure<T> > { > protected T return(T retval) throws LongReturn<T>{ > throw new LongReturn<T>(retval); > } > > } > > abstract class MyForeach<T> > { > public <RV> void foreach(#ControlClosure<RV>(void(T)LongReturn<RV>) > closure); > > } > > BR, > John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
