Proposed library Boost Exception updated

Hello, I made a minor change in the type registration mechanism from using macros to this: struct my_tag: boost::exception_info_tag<int> { }; This update addresses the issue of being able to register tags in user-defined namespaces. The updated documentation and source code can be found at http://www.revergestudios.com/boost-exception/boost-exception.html It is also possible to extend the interface to support enumeration of the exception info stored in boost::exception objects, but my personal preference is to first collect more feedback from people using the library, because I'm not sure if this enumeration is needed in practice. Brad King illustrated this idea in his earlier post: http://article.gmane.org/gmane.comp.lib.boost.devel/146322 I've also received feedback that boost::exception_info would be used fairly often and needs a shorter name. Maybe boost::xinfo? I hope someone comes up with a better name. Finally, I would ask everyone who provided feedback before to please use the mailing list for that. Having an open discussion is important. Thanks, Emil Dotchevski

Emil Dotchevski wrote:
I've also received feedback that boost::exception_info would be used fairly often and needs a shorter name. Maybe boost::xinfo? I hope someone comes up with a better name.
boost::exception_info is just perfect. write once - read many. long and descriptive name is much better from a long-time perspective. one idea to slightly reduce syntactic overhead: provide a way to replace: throw fopen_error() << boost::exception_info<tag_errno>(errno) << boost::exception_info<tag_file_name>(name) << boost::exception_info<tag_open_mode>(mode) << boost::exception_info<tag_function>("fopen"); with throw fopen_error() << boost::exception_info<tag_errno, tag_file_name, tag_open_mode, tag_function>(errno, name, mode, "fopen"); but it has a drawback that one can easily permutate variables and compiler would not catch it in some cases. something like throw fopen_error() << boost::exception_info(tag_errno(), errno) (tag_file_name(), name) (tag_open_mode(), mode) (tag_function(), "fopen"); would be better. Best, Oleg Abrosimov.

"Emil Dotchevski" wrote:
http://www.revergestudios.com/boost-exception/boost-exception.html
It is also possible to extend the interface to support enumeration of the exception info stored in boost::exception objects, but my personal preference is to first collect more feedback from people using the library, because I'm not sure if this enumeration is needed in practice. Brad King illustrated this idea in his earlier post:
I believe this functionality should be present and will be used extensively at the top level of an application. There should be also ability to support visitation of exception objects. Imagine situation: try { .... } catch (boost::exception& e) { e << ....; // now some exceptions could be handled // and some need to be passed up ???? The ??? could be typeswitch or it could be a visitor object passed into the exception. The visitor would be able to throw original or new exception or handle the situation. The visitor could be separated, reused and is more dynamic than a typeswitch. /Pavel Just FYI: on http://www.nwcpp.org/Downloads/2006/The_Power_of_None.ppt is slide show from Andrei Alexandrescu and Petru Margineanu suggesting capability to employ either exceptions or local error handling at will.

Hi! Emil Dotchevski schrieb:
I've also received feedback that boost::exception_info would be used fairly often and needs a shorter name. Maybe boost::xinfo? I hope someone comes up with a better name.
Can you change it to boost::exception::info ? Then in functions where it's used just do a using boost::exception::info; This makes it short to type but yet good to read (I hope). Frank

Frank Birbacher wrote:
Hi!
Emil Dotchevski schrieb:
I've also received feedback that boost::exception_info would be used fairly often and needs a shorter name. Maybe boost::xinfo? I hope someone comes up with a better name.
Can you change it to boost::exception::info ? Then in functions where it's used just do a using boost::exception::info; This makes it short to type but yet good to read (I hope).
Currently, exception_info is a namespace-scope function template. This fits best with the rest of the library design. I think it is not a good idea to change that; I certainly don't like the idea of making it a member of class boost::exception. --Emil
participants (4)
-
Emil Dotchevski
-
Frank Birbacher
-
Oleg Abrosimov
-
Pavel Vozenilek