On 2010-12-19 01:01, Nick Sabalausky wrote:
"Walter Bright"<newshou...@digitalmars.com>  wrote in message
news:iejejo$pf...@digitalmars.com...
Nick Sabalausky wrote:
Any problem with the other Scala/C#-style one?:

(x, y) =>   x * y

// Lowered to:

(x, y) { return x * y; }

(Maybe that was rejected before due the the weird float operators that
are now being ditched?)

The problem with the (x,y) parameter lists, where x and y are the
parameters, is that it is ambiguous with the existing syntax of (x,y)
where x and y are types and the parameters are omitted.

For example:

void foo(int);

But we already have:

     (x, y) { return x * y; }

So either there aren't any problems with it after all, or D's existing
delegate syntax is already broken.

To be clear, with what I'm trying to suggest, the *only* thing that would be
different from the current delegate literal syntax is that part *after* the
parameter list. Ie:

     PARAM_LIST_HERE { return x * y; }
     // -->
     PARAM_LIST_HERE =>  x * y

Or if there's a problem with =>, then ->, or -->, or ::>, or :>, or
whatever. I'm not suggesting the param list be different in any way fromhow
t is now. (Although proposals from other people might differ.)

^^ Exactly. I would also like to have type inference for the parameter list, do we have that already in D2?

--
/Jacob Carlborg

Reply via email to