transparent lambda

Neal Gafter neal at gafter.com
Thu Jan 7 15:04:53 PST 2010


On Thu, Jan 7, 2010 at 1:39 AM, John Rose <John.Rose at sun.com> wrote:

> On Jan 7, 2010, at 12:13 AM, Neal Gafter wrote:
>
> >> With no need for parens in most places, especially argument and
> initializer expressions:
> >
> > Without the parens it is ambiguous with a labelled statement.
>
> Actually, I think it's better to regard it as the *same* syntax in both
> places.
>

I don't think so.  Expressions and statements should be syntactically
distinct.  For example, consider this labelled block statement followed by
an empty statement:

  label : {}
  ;

And now consider this expression-statement that consists of a labelled block
expression

  label : {} ;

how can you tell which is which?


> Would it be enough to say that a statement expression will not begin with a
> labeled block?  This could be enforced by adjusting the grammar, or by
> adding a syntax constraint on top of the expression-statement nonterminal.
>

I think it is best to minimize the number of special forms and special rules
about the way the language primitives interact.  People would get very
confused when they try to write a block expression that begins with a
labeled block.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20100107/c5093c40/attachment.html 


More information about the closures-dev mailing list