Jon Zeppieri wrote:
> 2008/12/3 P T Withington <[EMAIL PROTECTED]>:
>> - prefix ^ might be confused with the infix operator of the same name
> 
> With semicolon insertion, isn't this a bigger problem?
> 
> The opening brace will need to be on the same line as the formals,
> otherwise the syntax is ambiguous:
> 
> ^(x) {
>   x = x * x
>   ^(a,b,c,d,e,f,g)
>   {
>     x
>   }
> }

Strictly speaking, the syntax is not ambiguous; it just is not parsed
how you might expect. The semicolons would be inserted in this example
as follows:

  ^(x) {
    x = (x * x)^(a, b, c, d, e, f, g);
    { x; }
  };

Arguably, the problem here is that semicolon insertion is and always
was a bad idea.

> And, if it is on the same line, it's still bad for a top-down parser:
> 
> ^(x) {
>   x = x * x
>   ^(a,b,c,d,e,f,g) {x}
> }

Same result as above.

> Will semicolon insertion be illegal inside a lambda body?

That's worth considering. It does not prevent lambdas from being used
to desugar other constructs, because semicolon insertion would be
performed on the original program before desugaring.

-- 
David-Sarah Hopwood

_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to