The Right Approach to Exceptions

Jose Armando Garcia jsancio at
Wed Feb 22 06:34:50 PST 2012

On Tue, Feb 21, 2012 at 6:32 PM, deadalnix <deadalnix at> wrote:
> Le 21/02/2012 00:23, Andrei Alexandrescu a écrit :
>> On 2/20/12 4:44 PM, Juan Manuel Cabo wrote:
>>> HAhaha, it sometimes feel as though people are afraid that the
>>> Variant[string]
>>> idea is to never use plain old variables and never use exception
>>> subclasses. :-)
>>> On the contrary, the idea is so that plain old variables and exception
>>> subclasses
>>> can be created for the right reasons, and to remove cases where they need
>>> to be created for the wrong reasons.
>> Yah, I think there's a lot of confusion and consequent apprehension
>> regarding this. Thanks for attempting to clarify things.
>> Andrei
> So it doesn't help. Dulb subclasses of Exceptions are done mostly to be able
> to catch them. To avoid useless subclasses, we need a more precise way to
> catch Exception than the type only.

Agreed. I would love it if catch worked using a structural/pattern
matching mechanism. Something like template's if clause or like Scala
pattern matching...

> This Variant[string] doesn't help.

More information about the Digitalmars-d mailing list