Syntax options
Bob Foster
bobfoster at gmail.com
Mon Jun 20 23:52:58 PDT 2011
On Mon, 20 Jun 2011 11:46:46 -0400 Brian Goetz wrote:
>
> Several people have asked for clarification about the bounds of the
> various families of syntax options that were suggested in the poll.
> Here's an attempt to flesh out the option space for the families of
> options we've been discussing.
> ...
Thanks, Brian. The survey examples suffered from zeroOrOneArgument-itis.
You've corrected that best for Redmond. Much appreciated.
I prefer Ali Ebrahimi's proposal, which I believe is Redmond as you describe
with no variants or options except that the nilary examples are modified to:
Expression form:
Nilary example: -> 3
Statement form:
Nilary example: -> { return 3 }
His proposal appears to reduce the syntax to its bare bones without reducing
clarity. A similar thing could be done with the # prefix notation, but I
find the infix -> notation less jarring to the eye and, as you said in the
survey, there is some precedent for it in Scala.
I realize that grammars aren't appropriate for quick take-the-pulse surveys,
but in the aftermath Ali Ebrahimi has done us all a favor by providing a
grammar to clarify his modest and simplifying departure from Redmond, as
quoted below:
On Mon, 20 Jun 2011 12:42:52 +0330 Ali Ebrahimi wrote:
>
> Hi,
> And this is full grammar:
>
> LambdaDeclaration =
> LambdaParameterList '->' LambdaBody
>
> LambdaParameterList =
> LambdaParameter? | '(' ( LambdaParameter ( ',' LambdaParameter )*
)? ')'
>
> LambdaParameter =
> Parameter | Identifier
>
> LambdaBody =
> Expression | `{' Statement* `}'
Bob
More information about the lambda-dev
mailing list