The Right Approach to Exceptions

Jacob Carlborg doob at me.com
Tue Feb 21 12:26:37 PST 2012


On 2012-02-21 21:06, Andrei Alexandrescu wrote:
> On 2/21/12 12:03 PM, Jacob Carlborg wrote:
>> 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.
>
> I think I do. It's also fair to ask you if you are sure you understood
> my point.
>
> Andrei

As I said, it seems you want to push up implementation details specific 
to a given subclass to the base class even though it shouldn't be pushed up.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list