Implicit return syntax error

JmH jason.height at gmail.com
Thu Dec 10 14:46:06 PST 2009


Hello,

Firstly my name is Jason Height and aside from using java for many years i
have no formal experience in writing of extending programming languages.

However, this does not prevent me from having an opinion!

I just started reading the strawman proposal and i would like to discuss the
benefit/reasons of having an implict return statement for the simple
expressions. I actually believe for a person with little or no experience in
closures that the statement "#()(return 42;)" rather than "#()(42)" is far
more readable and natural when compared to the existing jls. A syntax error
is be generated if one omits the "return" keyword for a function ie:

public int getFortyTwo() {
  42;
}

As such i propose that the straw man proposal should be changed to so
implicit returns are syntax errors.

Thanks for reading.

Jason


More information about the lambda-dev mailing list