Consider:

https://github.com/D-Programming-Language/phobos/blob/master/std/c/windows/com.d#L218

This is D's support for COM objects. They have AddRef() and Release(), i.e. they are reference counted. They do not inherit from Object. The refcounting is currently manual.

D could allow an additional root (not a replacement) for thrown Exceptions. This root would be based on ComObject.

As a bonus, COM objects were designed for C++, and C++ implements them well, i.e. they would be a compatible object structure.

catch statements could be changed to catch ComThrowable, which would not catch Throwables, and catches for Throwables would not catch ComThrowables.

Reply via email to