Boost logo

Boost :

From: Dean Michael Berris (mikhailberis_at_[hidden])
Date: 2006-07-03 04:41:56

On 7/3/06, Emil Dotchevski <emildotchevski_at_[hidden]> wrote:
> I am not quite sure how to inerpret this... Is it "go ahead, we'll discuss
> the details during the formal review process"? Or is it complete lack of
> interest for adding such a library to Boost?

I just read through a good part of the documentation, and I see good
potential uses for this library. I have a couple of concerns though,
please see below...

> Anyway... Here is the link to the documentation again:
> If you click "download", you'll get the source code, as well as an example
> and a test suite, complete with Boost Build jamfiles.

I haven't downloaded the files yet, but am planning to test them out
soon. I have a few questions though, which you might be able to

1) use of dynamic_cast in the following snippet:

 catch( read_error & x )
    if( exception_info * xi = dynamic_cast<exception_info *>(&x) )
        if( exception_errno * err = get_errno(*xi) )
            ....; //err->code() is the captured errno.
                  //err->strerror() is the corresponding error string.

Perhaps this will be a major barrier to adoption, since it reads more
like a kludge than a way of exposing a well-thought about interface.

This also seems like too much work for exception handling -- which
seems harder to do than just creating my own exception class which
derives from std::exception, and then a custom constructor that
contains a copy of the information object that I know I want to be
available from those that will be receiving the exception.

Is there a good reason why you're not using a "composite-style" [see
GoF composite pattern] exception if you intend to be able to add
information as the exception is propagated through the try {}
catch(...) {} blocks?

2) Have you considered using Boost.Fusion to create mappings of
compile-time types to runtime values so that you can access the
information objects in a type-safe manner? I'm not an expert about it,
but it might be easier to do something like:

catch (exception_info & x) {
  my_type temp = at_key<my_type>(x.objects);

Wherein `x.objects` is a Boost.Fusion map, and allows you to map
values to types? Perhaps you can come up with another way of avoiding
the use of dynamic_cast<>() but with what you're trying to achieve, I
think Boost.Fusion will definitely be able to help you out with the
interface part.

I think I have more questions, but I will reserve them when either the
library gets scheduled for formal review, or when I actually get the
time to test out the available implementation.

But generally, on my part I am interested in this library.

Dean Michael C. Berris
C/C++ Software Architect
Orange and Bronze Software Labs
Mobile: +639287291459
Email: dean [at] orangeandbronze [dot] com

Boost list run by bdawes at, gregod at, cpdaniel at, john at