Proposal: Block Expressions for Java

Stephen Colebourne scolebourne at joda.org
Sat Mar 7 07:57:19 PST 2009


> On Fri, Mar 6, 2009 at 12:50 PM, Tim Peierls <tim at peierls.net> wrote:
>> I kind of like Neal's block expression proposal, but I am struggling to find
>> more compelling examples for it.

Neal Gafter wrote:
 > The places I would have found this most useful are in a super()
 > invocation, where you simply can't write a local variable before,

The correct solution to this is to allow code before super(). That might 
be out of scope for Coin, but it is a better solution.

 > in a control-flow expression of one sort or another, like ?:, &&, ||,
 > or on the right-hand-side of an assert statement.  This kind of thing
 > is particularly useful in automatically-generated code.

Again, there is a use case here, but manly for auto-generated code. (The 
cases where this comes up otherwise are very rare, and handled by a 
static method).

Adding this feature isn't overly harmful, but I don't think its 
especially in the Java-style (ie. it fits expression only languages like 
Scala).

Personally I'm opposed.

Stephen



More information about the coin-dev mailing list