Re: Discrete semantics of lambda expressions

2016-05-02 Thread Timon Gehr via Digitalmars-d
On 02.05.2016 22:20, Adam D. Ruppe wrote: On Monday, 2 May 2016 at 20:11:53 UTC, Timon Gehr wrote: I don't think { ... } as shorthand for (){ ... } is necessary or particularly useful in the first place. Indeed. I don't think =>x as a shorthand for {return x;} is really worth it either... D ha

Re: Discrete semantics of lambda expressions

2016-05-02 Thread Adam D. Ruppe via Digitalmars-d
On Monday, 2 May 2016 at 20:11:53 UTC, Timon Gehr wrote: I don't think { ... } as shorthand for (){ ... } is necessary or particularly useful in the first place. Indeed. I don't think =>x as a shorthand for {return x;} is really worth it either... D has a ridiculous number of variations on fu

Re: Discrete semantics of lambda expressions

2016-05-02 Thread Timon Gehr via Digitalmars-d
On 02.05.2016 19:31, Adam D. Ruppe wrote: On Monday, 2 May 2016 at 15:52:34 UTC, Xinok wrote: I'm proposing that we add a warning to the compiler for this particular case. If the programmer intended to return a lambda, then rewrite the expression as one of: I agree, forcing people to rewrite i

Re: Discrete semantics of lambda expressions

2016-05-02 Thread Adam D. Ruppe via Digitalmars-d
On Monday, 2 May 2016 at 15:52:34 UTC, Xinok wrote: I'm proposing that we add a warning to the compiler for this particular case. If the programmer intended to return a lambda, then rewrite the expression as one of: I agree, forcing people to rewrite it is a good idea.

Discrete semantics of lambda expressions

2016-05-02 Thread Xinok via Digitalmars-d
D has a few ways of writing lambda expressions / anonymous functions: x => doSomething() { doSomething(); } (){ doSomething(); } While the flexibility is great, there's a hidden issue for those programmers who come from different languages and are used to writing: x => { doS