[type_erasure] Review ends today July 27, 2012

Hello all, On Mon, Jul 23, 2012 at 9:09 AM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
On Wed, Jul 18, 2012 at 1:13 AM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
*** The review of Steven Watanabe's proposed Boost.TypeErasure library begins on July 18, 2012 and ends on July 27, 2012. ***
*** Boost.TypeErasure review ends in 5 days. Please submit your reviews :D ***
*** Boost.TypeErasure review ends today July 27, 2012. If you are planning to submit a review, please do so as soon as possible. *** Thank you to everyone who has commented on the library and submitted a review so far! The review manager, --Lorenzo P.S. I am considering extending the review until end of day Sunday July 29, 2012... I will keep you posted.
There have been interesting discussions on the library on the ML but I have not received any official review yet :( Especially if you are a user of Boost Any, Function, and Any Iterator, you definitely want to take a look at Type Erasure as it generalizes solutions provided by those other libraries.
Thank you.
The review manager. --Lorenzo
THE LIBRARY
C++ provides runtime polymorphism through virtual functions. They are a very useful feature, but they do have some limitations. * They are intrusive. In generic programming, we can design an interface which allows third-party types to be adapted to it. * They require dynamic memory management. Of course, most of the problems can be avoided by using an appropriate smart pointer type. Even so, it still acts like a pointer rather than a value. * Virtual functions' ability to apply multiple independent concepts to a single object is limited. The Boost.TypeErasure library solves these problems allowing us to mirror static generic programming at runtime.
Library source: http://svn.boost.org/svn/boost/sandbox/type_erasure/
Pre-built documentation: http://steven_watanabe.users.sourceforge.net/type_erasure/libs/type_erasure/
You can also download archives with pre-built documentation from: http://sourceforge.net/projects/steven-watanabe.u/files/
YOUR REVIEW
Please submit a review to the mailing-list by replying to this email ("[boost] [type_erasure] Review ..." should be in the subject).
Please state clearly whether you think this library should be accepted as a Boost library.
Other questions you may want to consider: 1. What is your evaluation of the design? 2. What is your evaluation of the implementation? 3. What is your evaluation of the documentation? 4. What is your evaluation of the potential usefulness of the library? 5. Did you try to use the library? With what compiler? Did you have any problems? 6. How much effort did you put into your evaluation? A glance? A quick reading? In-depth study? 7. Are you knowledgeable about the problem domain?
Thanks in advance to all who participate in the review discussion -- I'm looking forward to it!

On 7/27/12 9:22 AM, Lorenzo Caminiti wrote:
Hello all,
On Mon, Jul 23, 2012 at 9:09 AM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
On Wed, Jul 18, 2012 at 1:13 AM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
*** The review of Steven Watanabe's proposed Boost.TypeErasure library begins on July 18, 2012 and ends on July 27, 2012. ***
*** Boost.TypeErasure review ends in 5 days. Please submit your reviews :D ***
*** Boost.TypeErasure review ends today July 27, 2012. If you are planning to submit a review, please do so as soon as possible. ***
I will submit one, but can't do it before sunday. regards Fabio

Please state clearly whether you think this library should be accepted as a Boost library.
Yes. Absolutely.
1. What is your evaluation of the design?
Library design is clean. Using MPL for defining concepts is a good choice.
2. What is your evaluation of the implementation?
Haven't look in details.
3. What is your evaluation of the documentation?
Documentation isn't bad, but i would like to have more mini real-world examples for each section (i.e. Functions with multiple arguments, References, ...).
4. What is your evaluation of the potential usefulness of the library?
For me, it has a great potential. Now, I know exactly two places where I could use it in my project.
5. Did you try to use the library? With what compiler? Did you have any problems?
No, haven't tried. Only look at examples.
6. How much effort did you put into your evaluation? A glance? A quick reading? In-depth study?
3 - 4 hours.
7. Are you knowledgeable about the problem domain?
I'm not an expert, but I'm using boost::any with minor custom modification and own visitation framework. Also have used boost ranges' any_iterator. Thank you, Trigve

AMDG On 07/27/2012 10:29 AM, Trigve Siver wrote:
3. What is your evaluation of the documentation?
Documentation isn't bad, but i would like to have more mini real-world examples for each section (i.e. Functions with multiple arguments, References, ...).
This is a common theme of the reviews so far. I'll work on it. In Christ, Steven Watanabe

Hello all, After consulting the review wizards and Steven, I am extending Boost.TypeErasure review of one week, until August 3, 2012. Thank you to all that have submitted a review already and I am looking forward to receiving additional submissions. The review manager, --Lorenzo On Jul 27, 2012 3:22 AM, "Lorenzo Caminiti" <lorcaminiti@gmail.com> wrote:
Hello all,
On Mon, Jul 23, 2012 at 9:09 AM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
On Wed, Jul 18, 2012 at 1:13 AM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
*** The review of Steven Watanabe's proposed Boost.TypeErasure library begins on July 18, 2012 and ends on July 27, 2012. ***
*** Boost.TypeErasure review ends in 5 days. Please submit your reviews :D ***
*** Boost.TypeErasure review ends today July 27, 2012. If you are planning to submit a review, please do so as soon as possible. ***
Thank you to everyone who has commented on the library and submitted a review so far!
The review manager, --Lorenzo P.S. I am considering extending the review until end of day Sunday July 29, 2012... I will keep you posted.
There have been interesting discussions on the library on the ML but I have not received any official review yet :( Especially if you are a user of Boost Any, Function, and Any Iterator, you definitely want to take a look at Type Erasure as it generalizes solutions provided by those other libraries.
Thank you.
The review manager. --Lorenzo
THE LIBRARY
C++ provides runtime polymorphism through virtual functions. They are a very useful feature, but they do have some limitations. * They are intrusive. In generic programming, we can design an interface which allows third-party types to be adapted to it. * They require dynamic memory management. Of course, most of the problems can be avoided by using an appropriate smart pointer type. Even so, it still acts like a pointer rather than a value. * Virtual functions' ability to apply multiple independent concepts to a single object is limited. The Boost.TypeErasure library solves these problems allowing us to mirror static generic programming at runtime.
Library source: http://svn.boost.org/svn/boost/sandbox/type_erasure/
Pre-built documentation:
http://steven_watanabe.users.sourceforge.net/type_erasure/libs/type_erasure/
You can also download archives with pre-built documentation from: http://sourceforge.net/projects/steven-watanabe.u/files/
YOUR REVIEW
Please submit a review to the mailing-list by replying to this email ("[boost] [type_erasure] Review ..." should be in the subject).
Please state clearly whether you think this library should be accepted as a Boost library.
Other questions you may want to consider: 1. What is your evaluation of the design? 2. What is your evaluation of the implementation? 3. What is your evaluation of the documentation? 4. What is your evaluation of the potential usefulness of the library? 5. Did you try to use the library? With what compiler? Did you have any problems? 6. How much effort did you put into your evaluation? A glance? A quick reading? In-depth study? 7. Are you knowledgeable about the problem domain?
Thanks in advance to all who participate in the review discussion -- I'm looking forward to it!

Please state clearly whether you think this library should be accepted as a Boost library.
Yes. I vote to accept.
Other questions you may want to consider: 1. What is your evaluation of the design?
Outstanding.
2. What is your evaluation of the implementation?
Haven't looked.
3. What is your evaluation of the documentation?
I just skimmed through the docs to get what I need (see below). It would be good to have examples at the bottom of each of the reference sections like that of MPL, Fusion and the PPlib. Example: http://www.boost.org/doc/libs/1_50_0/libs/mpl/doc/refmanual/fold.html At the bottom, we have an example.
4. What is your evaluation of the potential usefulness of the library?
Extremely useful!
5. Did you try to use the library? With what compiler? Did you have any problems?
Yes. I tried to use it as a replacement for Boost.Function in Boost.Spirit. It worked like a charm. My only difficulty was in trying to figure out how to detect a default-initialized 'any'. With Boost.Function, you can use an instance in a condition, e.g. if (f) ... This seems to be not the case with 'any'. I'm pretty sure this is something simple to do, but I can't dig it out in the docs. I ended up casting to void*. It turns out that it returns 0 (null) if any hasn't been initialized yet. I'm not sure about the cost of that though (would that have to use RTTI? It seems that way as it says in the any_cast docs: http://tinyurl.com/d8sx46m where it says that typeid_ is required. I did a CT test on one of the largest examples in spirit. I compared it against 1) the original implementation using Boost.Function and 2) A hand-coded implementation using virtual functions. Here are the results: TypeErasure: 01:14 secs Boost.Function: 00:55 secs Virtual Function: 00:52 secs For that matter, I'm not ready to use TypeErasure yet for my purpose, but I'm hoping that Steven can improve CT. It might also be possible that I am using TypeErasure incorrectly when I resort to any_cast to test for null any. Would this explain the CT slowdown? I am not sure. I'd also suggest the addition of an easy to use Boost.Function replacement in there that can be used out of the box with full compliance. I know this is merely scratching the surface, but I am sure I'll be using TypeErasure's more powerful features.
6. How much effort did you put into your evaluation? A glance? A quick reading? In-depth study?
A few hours of study.
7. Are you knowledgeable about the problem domain?
I believe so. Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com

AMDG On 08/01/2012 05:34 AM, Joel de Guzman wrote:
3. What is your evaluation of the documentation?
I just skimmed through the docs to get what I need (see below). It would be good to have examples at the bottom of each of the reference sections like that of MPL, Fusion and the PPlib. Example:
http://www.boost.org/doc/libs/1_50_0/libs/mpl/doc/refmanual/fold.html
At the bottom, we have an example.
Noted.
5. Did you try to use the library? With what compiler? Did you have any problems?
Yes. I tried to use it as a replacement for Boost.Function in Boost.Spirit. It worked like a charm. My only difficulty was in trying to figure out how to detect a default-initialized 'any'. With Boost.Function, you can use an instance in a condition, e.g. if (f) ... This seems to be not the case with 'any'. I'm pretty sure this is something simple to do, but I can't dig it out in the docs.
any_cast to void* is the simplest way that exists right now. Something like this would enable a bool conversion: template<class T = _self> struct empty_bool_conversion : mpl::vector<> {}; template<class T, class Base> struct concept_interface<empty_bool_conversion<T>, Base, T> : Base { explicit operator bool() const { return any_cast<void*>(static_cast< const typename derived<Base>::type*>(*this)); } };
I ended up casting to void*. It turns out that it returns 0 (null) if any hasn't been initialized yet. I'm not sure about the cost of that though (would that have to use RTTI? It seems that way as it says in the any_cast docs: http://tinyurl.com/d8sx46m where it says that typeid_ is required.
I'll fix the documentation. RTTI shouldn't be required for a cast to void*.
I did a CT test on one of the largest examples in spirit. I compared it against 1) the original implementation using Boost.Function and 2) A hand-coded implementation using virtual functions. Here are the results:
TypeErasure: 01:14 secs Boost.Function: 00:55 secs Virtual Function: 00:52 secs
That's expected. There are a number of constructs that I know are inefficient in my metaprogramming. I haven't made any attempt to optimize it yet.
For that matter, I'm not ready to use TypeErasure yet for my purpose, but I'm hoping that Steven can improve CT. It might also be possible that I am using TypeErasure incorrectly when I resort to any_cast to test for null any. Would this explain the CT slowdown? I am not sure.
Using any_cast like this should have little effect on compile-time performance.
I'd also suggest the addition of an easy to use Boost.Function replacement in there that can be used out of the box with full compliance.
It isn't possible to replicate Boost.Function perfectly. a) Boost.Function doesn't care about the constness of function call operator. b) Boost.Function has special handling for boost::ref I don't really want to replicate either behavior. In Christ, Steven Watanabe

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Joel de Guzman Sent: Wednesday, August 01, 2012 1:35 PM To: boost@lists.boost.org Cc: boost-users@lists.boost.org Subject: Re: [boost] [type_erasure] Review ends today July 27, 2012
3. What is your evaluation of the documentation?
I just skimmed through the docs to get what I need (see below). It would be good to have examples at the bottom of each of the reference sections like that of MPL, Fusion and the PPlib. Example:
http://www.boost.org/doc/libs/1_50_0/libs/mpl/doc/refmanual/fold.html
At the bottom, we have an example.
I'd like to second this suggestion, having had an deeply look at the docs (and playing with the code). Examples are *really, really, really* useful. More examples, well commented, like the sequence printers would be valuable. I'd like a long kitchen-sink example that guides you up gently. I found the learning curve to be near vertical (needing a lots of 'Friends' as the rock climbers say). The quality of the docs is excellent, but it needs to take users much more by the hand and go slowly, including lots of example en route. To be widely used, the docs need to be usable by the 'great unwashed'. Feedback from novices may be the best guide to where the 'overhangs' lie. I noted that the name boost::type_erasure::any shares with boost::any (deliberately) : this creates a namespace-confusion pit into which user are bound to fall. A warning would be useful? Is prior knowledge of Boost.Any required or a hindrance? Wikipedia has a definition of type_erasure that might be referenced? HTH Paul --- Paul A. Bristow, Prizet Farmhouse, Kendal LA8 8AB UK +44 1539 561830 07714330204 pbristow@hetp.u-net.com
participants (6)
-
Fabio Fracassi
-
Joel de Guzman
-
Lorenzo Caminiti
-
Paul A. Bristow
-
Steven Watanabe
-
Trigve Siver