Then we could use interfaces as "tags" for exceptions and catch using one of many interfaces an exception has. Consider DIP33:
http://wiki.dlang.org/DIP33

The 2 problems it had were:

1. enums are hard to extend for std lib, and absolutely impossible by 3rd party libraries. 2. Single hierarchy has some appeal but it doesn't allow to catch on similar classes that do not inherit from the same base class. Basically there are many ways to view similarities of excpetions and single hierarchy fails to address that.

If we were to replace each class with a base interface and every Kind enum with an interface (inhereting from one or more base interfaces) then we can actually address both of these points.

To druntime experts - is it hard to change Throwable to be an interface? What exactly EH system needs of Throwable?

--
Dmitry Olshansky

Reply via email to