Boost logo

Boost :

From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2006-07-20 08:27:13


On 7/19/06, Alexander Nasonov <alnsn_at_[hidden]> wrote:
>
> I don't know a practical value of this library except probably
> a management of exception handlers order [...]

While this library is mostly a solution in search of a problem, I see at
least a good pratical use for this. Consider a library Foo that can work
both by trowing exceptions or by returning error codes (for example for
perceived better performance). The return codes, instead of being a set of
values, are a set of types and are returned as a variant.

This means that the user of library Foo can use the exception visitor both
as a variant visitor and as an exception visitor.

With appropriate infrastructure, the same code can work both if the library
Foo uses exceptions or
uses return codes (for example, you may use exceptions by default and
convert to return codes in the critical paths or where error are common and
expected, with minimal changes in code).

Of course Foo would use the same types both as exceptions types and as
result types.

I have done this once and it kind of work well.

--
Giovanni P. Deretta

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