Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-11-13 14:51:17


"Peter Dimov" <pdimov_at_[hidden]> writes:

> David Abrahams wrote:
>
>> Finally, a design note: I don't like the fact that I need a try/catch
>> block in order to adorn the currently-unwinding exception with more
>> information; it's just too heavy syntactically. I realize it would
>> require TLS for thread-safety, but I'd like to see an option that uses
>> the destructor of a local object to do the same work.
>
> It isn't clear how do you think this should work. Your TLS remark implies
> that the information would be stored separately from the exception object
> itself, but as you very well know, more than one exception can be active at
> a time.

Yep, you'd need a stack.

> Moving the catch clause to a destructor doesn't seem an improvement
> to me.

Using a catch clause to add information to a propagating exception
feels syntactically heavy to me, but of course others may disagree.
And it may also be that without language support, there's not really a
good way to avoid that weight. I'm just expressing an aesthetic
preference here.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk