More exception classes into Phobos?

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 23 18:50:57 PDT 2017


On Thursday, 23 March 2017 at 20:48:24 UTC, Jonathan M Davis 
wrote:
> And in cases like D scripts, it would be overkill to be forced 
> to create your own exception types, so it would really annoying 
> if you couldn't create Exceptions.

Creating a new exception class is actually trivial  in D, we 
create new types all the time without even thinking about it 
almost every time we hit `!`, and could be even more so with some 
library helpers.

Catching the type when it doesn't have an outside name isn't as 
easy, but the randomly created types can still inherit from some 
base class that is caught, but the templated/generated 
implementation overrides various interface functions to provide 
more detailed, rich information (and, of course, you CAN still 
catch it specifically if you really wanted to).


More information about the Digitalmars-d mailing list