Walter Bright , dans le message (digitalmars.D:144959), a écrit : > I've collected a few from various languages for comparison: > > D > (a,b) { return a + b; }
Few ideas: (a,b){ a + b } Lambdas can avoid to type 'return'. returning void would be harder, except if to return void, you can just put the semicolon at the end (but it could be confusing). a, b -> a + b Introduce a -> "operator" to generate a delegate. Depending on the precedence, "(a,b) -> (a + b)" might be prefered. "(a,b -> a+b)" will be safer to use obviously. I prefer that instead of {a,b -> a+b} because the second adds a different meaning to {}, which is different from "statement grouping" and "function body". The => symbol is fine too, but looks like a mistyped comparison operator to me. -- Christophe