Can we make Throwable an interface?

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 10 11:47:46 PST 2014


10-Dec-2014 11:20, Kagamin пишет:
> On Tuesday, 9 December 2014 at 18:07:16 UTC, H. S. Teoh via
> Digitalmars-d wrote:
>> what is more interesting is "was this failure caused by permission
>> error?".
>
> And what if it does?
> You would create thousands of types and their cartesian products just to
> check for one of them?

There is no need for cartesian products.
E.g.
interface ConversionException { }
interface Overflow : ConversionException  {}
interface Underflow : ConversionException  {}
...

Basically enum in DIP 33 expends to a set of dervied interfaces.

Anyhow enums do not allow one to catch based on them which already makes 
them highly unusable.

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list