Re: Throwing from a lambda isn't supported by the compiler

2019-09-09 Thread Dennis via Digitalmars-d-learn
On Monday, 9 September 2019 at 13:22:22 UTC, Johannes Loher wrote: This is incorrect. It was rejected because the proposal was not solid enough. I put that a bit bluntly, but as far as I see it, the DIP focused too much on only adding a way to mark functions as 'no return' that people were

Re: Throwing from a lambda isn't supported by the compiler

2019-09-09 Thread Johannes Loher via Digitalmars-d-learn
On Monday, 9 September 2019 at 10:46:10 UTC, Dennis wrote: Such a shame it got rejected in favor of ugly 'no return' annotations [...] This is incorrect. It was rejected because the proposal was not solid enough. While it is true that a lot of people seemed to prefer an annotation based

Re: Throwing from a lambda isn't supported by the compiler

2019-09-09 Thread Dennis via Digitalmars-d-learn
On Monday, 9 September 2019 at 09:37:25 UTC, a11e99z wrote: cuz throwing exception ever is not compatible with any return type so I dont see reasons do not allow such expressions A throw statement can actually be seen as an expression returning a 'never' / 'bottom' type which is implicitly

Re: Throwing from a lambda isn't supported by the compiler

2019-09-09 Thread Andre Pany via Digitalmars-d-learn
On Monday, 9 September 2019 at 09:37:25 UTC, a11e99z wrote: On Monday, 9 September 2019 at 09:14:08 UTC, Andre Pany wrote: I noticed, that I cannot throw from the lambda expression: Error: expression expected, not throw but have to use the longer syntax () {throw new Exception();} --- void

Re: Throwing from a lambda isn't supported by the compiler

2019-09-09 Thread a11e99z via Digitalmars-d-learn
On Monday, 9 September 2019 at 09:14:08 UTC, Andre Pany wrote: I noticed, that I cannot throw from the lambda expression: Error: expression expected, not throw but have to use the longer syntax () {throw new Exception();} --- void foo(void function() e){} void main() { foo( () =>

Re: Throwing from a lambda isn't supported by the compiler

2019-09-09 Thread Boris Carvajal via Digitalmars-d-learn
On Monday, 9 September 2019 at 09:14:08 UTC, Andre Pany wrote: Hi, I noticed, that I cannot throw from the lambda expression: Error: expression expected, not throw but have to use the longer syntax () {throw new Exception();} --- void foo(void function() e){} void main() { foo(

Throwing from a lambda isn't supported by the compiler

2019-09-09 Thread Andre Pany via Digitalmars-d-learn
Hi, I noticed, that I cannot throw from the lambda expression: Error: expression expected, not throw but have to use the longer syntax () {throw new Exception();} --- void foo(void function() e){} void main() { foo( () => throw new Exception() ); } --- The shorter lambda