The Right Approach to Exceptions

deadalnix deadalnix at gmail.com
Mon Feb 20 11:54:41 PST 2012


Le 20/02/2012 20:45, Jonathan M Davis a écrit :
> On Monday, February 20, 2012 20:42:28 deadalnix wrote:
>> Le 20/02/2012 20:27, Jonathan M Davis a écrit :
>>> On Monday, February 20, 2012 11:15:08 H. S. Teoh wrote:
>>>> That's why I proposed to use runtime reflection to scan the exception
>>>> object for applicable fields. Then you get the best of both worlds: the
>>>> message formatter doesn't need to know what the fields are, and you get
>>>> full compile-time type checking for catching code that directly accesses
>>>> the fields.
>>>
>>> That would certainly be better.
>>>
>>> - Jonathan M Davis
>>
>> This is way better than Variant[string], but unimplemented ATM.
>
> Yes, but you can use compile-time constructs to generate it. And as you
> pointed out in another post, tupleof should do the trick. Regardless, the
> point is that using reflection of some kind is a much better solution than
> using variant.
>
> - Jonathan M Davis

Agreed !


More information about the Digitalmars-d mailing list