More exception classes into Phobos?
Георгий via Digitalmars-d
digitalmars-d at puremagic.com
Thu Mar 23 15:12:23 PDT 2017
On Thursday, 23 March 2017 at 21:31:28 UTC, Ola Fosheim Grøstad
wrote:
> On Thursday, 23 March 2017 at 16:44:51 UTC, Jonathan M Davis
> wrote:
> With a single hierarchy it becomes difficult, but with a
> multiple inheritance design it makes sense to have some
> standards. For instance whether the exceptional situation is
> permanent or warrants a retry.
Strong hierarchy is one of the reasons, that makes exception
types less reusable. You want to use a class, but it inherits
another class, that name contradicts what you want to say,
throwing the exception.
For instance, you want to say, that parsing goes wrong. And
somebody already made ParseException, but it is derived from
FileException. And your parsing doesn't relate to files or file
system at all.
On the other hand, the exception interfaces would be perceived
like tags at a blog article. Unfortunately, I don't know D good
enough. Is there the catch statements, that are active only for
such exceptions, that is match multiple types (implements all
enumerated interfaces) - if we want to catch a very specific case.
More information about the Digitalmars-d
mailing list