The Right Approach to Exceptions

Jacob Carlborg doob at me.com
Tue Feb 21 10:03:35 PST 2012


On 2012-02-21 17:57, Andrei Alexandrescu wrote:
> On 2/21/12 10:50 AM, Juan Manuel Cabo wrote:
>> I thought that an alternative to Variant[string] would be to have some
>> virtual
>> functions overrideable (getExceptionData(string dataName) or something).
>> but they would all have to return Object or Variant, so it's the same
>> thing.
>
> Exactly. By and large, I think in the fire of the debate too many people
> in this thread have forgotten to apply a simple OO design principle:
> push policy up and implementation down. Any good primitive pushed up the
> exception hierarchy is a huge win, and any design that advocates
> reliance on concrete types is admitting defeat.
>
> Andrei

That because you can't (shouldn't) push up implementations specific to a 
given subclass. Why don't we only have one class, Object, and add a 
Variant[string] there.

Do you see how stupid that is.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list