Syntax...

Rémi Forax forax at univ-mlv.fr
Fri Nov 20 17:54:33 PST 2009


Le 21/11/2009 00:18, Neal Gafter a écrit :
> On Fri, Nov 20, 2009 at 3:21 PM, Rémi Forax <forax at univ-mlv.fr 
> <mailto:forax at univ-mlv.fr>> wrote:
>
>     Sorry, I was not clear.
>     I am able to parse the current syntax and any parser will be able too,
>     but I am not sure everyone will be able to do the same.
>
>     One thing I have observed when teaching C is that the first
>     problem when explaining pointer was the C syntax.
>     This syntax use * when you declare a pointer type and * when you
>     want to dereference
>     a pointer variable. This syntax create unnecessary confusion.
>
>     If the syntax of closure use a symbol for lambda and another for
>     function type,
>     I will be happy.
>
>
> So you would prefer, for example, to use # for one of them and ^ for 
> the other?  If so, I think it must be # for the lambda (because method 
> references make closures, too) and ^ for the function type.
>
> *^int(int) plusOne = #(int x)x+1;
> *
>
> I wonder if a context-sensitive keyword would work?

A context sensitive keyword for function type seems easy, something like
*fun int(int) plusOne = #(int x)x+1;

*Because lambda are expression having a keyword for lambda, it seems 
less possible,
it can generate conflicts with method call.*

**^int() one = lambda () 1;*

Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20091121/86d9b9b0/attachment.html 


More information about the closures-dev mailing list