DIY checking exceptions

2017-06-26 Thread John Colvin via Digitalmars-d
On Sunday, 25 June 2017 at 17:38:14 UTC, mckoder wrote: I am disappointed that D doesn't have checked exceptions. I wonder what could be done with something like this: void foo(int a) { if (a > 0) throw new BlahException("blah"); throw new BloopException("bloop"); } unittest {

Re: DIY checking exceptions

2017-06-26 Thread Moritz Maxeiner via Digitalmars-d
On Monday, 26 June 2017 at 21:53:57 UTC, John Colvin wrote: On Sunday, 25 June 2017 at 17:38:14 UTC, mckoder wrote: I am disappointed that D doesn't have checked exceptions. I wonder what could be done with something like this: void foo(int a) { if (a > 0) throw new BlahException(

Re: DIY checking exceptions

2017-06-26 Thread jag via Digitalmars-d
On Monday, 26 June 2017 at 21:53:57 UTC, John Colvin wrote: I wonder what could be done with something like this: void foo(int a) { if (a > 0) throw new BlahException("blah"); throw new BloopException("bloop"); } unittest { // NEW FEATURE HERE alias Exceptions = __trait

Re: DIY checking exceptions

2017-06-26 Thread Moritz Maxeiner via Digitalmars-d
On Tuesday, 27 June 2017 at 00:10:32 UTC, jag wrote: On Monday, 26 June 2017 at 21:53:57 UTC, John Colvin wrote: I wonder what could be done with something like this: void foo(int a) { if (a > 0) throw new BlahException("blah"); throw new BloopException("bloop"); } unittest {

Re: DIY checking exceptions

2017-06-27 Thread John Colvin via Digitalmars-d
On Tuesday, 27 June 2017 at 00:10:32 UTC, jag wrote: On Monday, 26 June 2017 at 21:53:57 UTC, John Colvin wrote: I wonder what could be done with something like this: void foo(int a) { if (a > 0) throw new BlahException("blah"); throw new BloopException("bloop"); } unittest {