The Right Approach to Exceptions

foobar foo at bar.com
Tue Feb 21 08:26:23 PST 2012


On Tuesday, 21 February 2012 at 14:56:52 UTC, Andrei Alexandrescu 
wrote:
>>
>> Can you offer a real world use-case where the above isn't 
>> sufficient?
>
> This has been discussed. A function would want to add 
> contextual information to an exception and rethrow it. 
> Requiring a new type for each such flow does not scale.
>
>
> Andrei

This solution works given the fact that I know what type of data 
I want to add and I can't see a situation where that isn't the 
case. In Juan's case, he wanted to add an error code so he _knew_ 
already what type is required (int).
It seems we did a full circle. I'll ask again, what are you 
trying to optimize here? Number of instantiations?



More information about the Digitalmars-d mailing list