Inverted syntax option

John Nilsson john at milsson.nu
Tue Mar 16 09:47:00 PDT 2010


On Mon, Mar 15, 2010 at 11:36 PM, Bob Foster <bobfoster at gmail.com> wrote:

> Monstrosity, indeed. How do you feel about Remy Forax's proposal, e.g.:
>
>  baz((int x, int y)(x + y))
>
> (since I gather you like type inference) or:
>
>  baz(int(int x, int y)(x + y))


As you gather I actually preferr the top one ;-)
(but then you could just as well inferr the argument types too: (x,y)(x+y) )

Compared to most suggestions so for this one is actually bearable. Maybe
some minor tweaks to improve readability though. I think either the argument
list, or the actual expression, or maybe the whole thing, needs to have a
different wrapping, two parenthesies looks to symetric for something that is
completley different.

// Remove superflous parenthesis, makes it look more like a cast where
unbound variables are declared...
baz((int x, int y) x+y)

// If the argument list should resembel a method declaration, so should the
"body", no return though.
baz((int x, int y){x+y})

 // The argument list as an annotation to an expression;
baz(<int x, int y>(x+y))

 baz([int x, int y](x+y))

 baz({int x, int y}(x+y))

baz(|int x, int y| (x+y))

 baz((|int x, int y| x+y))

baz(@(int x, int y) x+y)

 baz((int x, int y)@(x+y))


// Go full out lambda ! (Inferred types)
baz(λx,y . x + y)


BR,
John


More information about the lambda-dev mailing list