Review Request: Generalization of the Pimpl idiom

I hope I am following the submission procedure correctly. I read the guidelines and I seem to do what is needed. Apologies if I missed something. The code is in the Boost Vault called Pimpl.zip It compiles with GCC 4.1.2 (I use it on Ubuntu 7.04) and MS Visual Studio 2005. Documentation is at DDJ site: http://www.ddj.com/cpp/205918714 Any questions/suggestions/critique - vladimir.batov@wrsa.com.au Thanks, Vladimir

Vladimir.Batov@wrsa.com.au wrote:
The code is in the Boost Vault called Pimpl.zip It compiles with GCC 4.1.2 (I use it on Ubuntu 7.04) and MS Visual Studio 2005. Documentation is at DDJ site: http://www.ddj.com/cpp/205918714 Any questions/suggestions/critique - vladimir.batov@wrsa.com.au
I have only quickly gone through your documentation on DDJ, so my comments may be off. Feel free to correct me if I misunderstood something. Personally, I fail to see the advantage over a shared_ptr member. The only differences I could notice are - implementation class is not user-declared but rather is a specialization of a template. - the null pointer is called null (by the way, I think we shouldn't allow a null value, the private implementation should always be initialized somehow, if lazily) There doesn't seem to be any useful help for allocating the private implementation. Such potentially interesting allocation schemes, like stack allocation, seem also to be impossible. Being able to replace the private implementation of a base with the private implementation of a derived class certainly is a necessity. I have to admit, though, I do not understand your solution. You're passing a null<Widget>() to the Widget constructor, but the constructor wasn't written to take any kind of special argument. I'm not really sure of the point (and validity) of having pointer semantics. Do you really want your implementation details to be shared by some of your different instances? (maybe there is a point in sharing implementation details with all instances or all equivalent instances, but some?) It seems more logical to me to have the same semantics for the object and its private implementation. If the object itself has pointer semantics, then you won't copy it. Using one or the other for the implementation makes no difference, then. You might as well use the value semantics, which would even be more lightweight in that case.

Vladimir.Batov@wrsa.com.au wrote:
The code is in the Boost Vault called Pimpl.zip
I haven't looked at your library, but one thing you need to do to get buy-in for this library is provide a comparison with the pimpl_ptr library that was proposed and rejected. My perception of the primary reason the library failed is that, despite being a basically sound library, it didn't work in the ways people wanted it to. It would be useful if you could summarize the vital details of your library, along with a comparison to the previous proposal, and other similar libraries, in your announcement message.

Hello, First of all, I think that a pimpl library should have a place in boost, but I think that the pimpl idiom do not scale very well (see below). Even if your library is usable in simple cases, I would like to see how it can manage more complex cases. And if no satisfactory solution to this case is possible, that the library states explicitly when it can not be used. Do you think to write the library documentation before the review? Even if there is a tutorial in DDJ, IMHO, you should spend some time on the documentation of the library before the review. --------------------------- Vicente Juan Botet Escriba ----- Original Message ----- From: <Vladimir.Batov@wrsa.com.au> To: <boost@lists.boost.org> Sent: Monday, March 31, 2008 6:34 AM Subject: [boost] Review Request: Generalization of the Pimpl idiom
I hope I am following the submission procedure correctly. I read the guidelines and I seem to do what is needed. Apologies if I missed something.
The code is in the Boost Vault called Pimpl.zip It compiles with GCC 4.1.2 (I use it on Ubuntu 7.04) and MS Visual Studio 2005. Documentation is at DDJ site: http://www.ddj.com/cpp/205918714 Any questions/suggestions/critique - vladimir.batov@wrsa.com.au
Thanks, Vladimir _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Hello, From: <Vladimir.Batov@wrsa.com.au> Subject: [boost] Review Request: Generalization of the Pimpl idiom
I hope I am following the submission procedure correctly. I read the guidelines and I seem to do what is needed. Apologies if I missed something.
The code is in the Boost Vault called Pimpl.zip It compiles with GCC 4.1.2 (I use it on Ubuntu 7.04) and MS Visual Studio 2005. Documentation is at DDJ site: http://www.ddj.com/cpp/205918714 Any questions/suggestions/critique - vladimir.batov@wrsa.com.au
Thanks, Vladimir
First of all, I think that a pimpl library should have a place in boost, but I think that the pimpl idiom do not scale very well and the library should present the advantages as well as the liabilities (see below). Are you thinking in writing the library documentation before the review? Even if there is a tutorial in DDJ, IMHO, you should spend some time on the documentation of the library before the review. Your library is usable in simple cases, I would like to see how it can manage more complex cases. If no satisfactory solution to these more complex cases is possible, the library documentation should express it explicitly. Could you clarify if the base implementation pointer can or can not be initialized with a pointer to the implementation of the derived class? There is something wrong in Base::Base(int k) : base(new BaseImpl(k)){} Derived1::Derived1(int k, int l) : Base(new Derived1Impl(k, l)) respect to Base::Base(int k) : base(null()) { reset(new BaseImpl(k)); } Derived1::Derived1(int k, int l) : Base(null<Base>()) { reset(new Derived1Impl(k, l)); } Could a class inherit privately from pimpl? class A : private pimpl<A>::value_semantics {...} There is something that seams extrange to me. If the pimpl is there to mask the implementation, doesn't adds the public inheritance of pimpl<A>::value_semantics some implemtation constraints? Note that public inheritance adds to the class interface the null() function, bool type conversion and ! operator, and adds also all the protected functions to the derevied classes. Can we found always a null object for every class when pimpl is not used? Can a class that inherits from a non pimpl class has its own private impl? class A; class B : A, public pimpl<B>::value_semantics {...} How the B implementation has access to A? maybe we need something like that class B : public pimpl<B, A>::value_semantics {...} making the implementation of B inherit from A. Could we inherit publicly from A and privatly from pimpl<B, A>::value_semantics? Can we manage with multiple inheritance? class A : public pimpl<A>::value_semantics {...}; class B : public pimpl<B>::value_semantics {...}; class C : public A, public B {...}; How pimpl interacts with STL containers? stl::list<A> al; B b; al.push_back(b); // ...somewhere else A a =al.pop_back(); How 'a' should behaves? like a A or like a B? The STL container user that shouldn't knowns nothing about A implementation, expect that it will behaves as a A, but it think that 'a' will behaves like a B. How can we protect from this situation? Could we store a non polymorph pimpl object in shared memory? Could we store non polymorph pimpl objects in a container in shared memory? I hope that you will find good solutions to these problems. In any case, I will apreciate that you include in the library documentation the limitations of the approach, if there are any. Regards _____________________ Vicente Juan Botet Escriba

Hi, this request do not figure in the review schedule. Have I mis a post? Best _____________________ Vicente Juan Botet Escriba ----- Original Message ----- From: <Vladimir.Batov@wrsa.com.au> To: <boost@lists.boost.org> Sent: Monday, March 31, 2008 6:34 AM Subject: [boost] Review Request: Generalization of the Pimpl idiom
I hope I am following the submission procedure correctly. I read the guidelines and I seem to do what is needed. Apologies if I missed something.
The code is in the Boost Vault called Pimpl.zip It compiles with GCC 4.1.2 (I use it on Ubuntu 7.04) and MS Visual Studio 2005. Documentation is at DDJ site: http://www.ddj.com/cpp/205918714 Any questions/suggestions/critique - vladimir.batov@wrsa.com.au
Thanks, Vladimir _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Ronald, please could you add this review request? Thanks Vicente ----- Original Message ----- From: "vicente.botet" <vicente.botet@wanadoo.fr> To: <boost@lists.boost.org> Sent: Monday, April 28, 2008 11:14 PM Subject: Re: [boost] Review Request: Generalization of the Pimpl idiom
Hi,
this request do not figure in the review schedule. Have I mis a post?
Best _____________________ Vicente Juan Botet Escriba ----- Original Message ----- From: <Vladimir.Batov@wrsa.com.au> To: <boost@lists.boost.org> Sent: Monday, March 31, 2008 6:34 AM Subject: [boost] Review Request: Generalization of the Pimpl idiom
I hope I am following the submission procedure correctly. I read the guidelines and I seem to do what is needed. Apologies if I missed something.
The code is in the Boost Vault called Pimpl.zip It compiles with GCC 4.1.2 (I use it on Ubuntu 7.04) and MS Visual Studio 2005. Documentation is at DDJ site: http://www.ddj.com/cpp/205918714 Any questions/suggestions/critique - vladimir.batov@wrsa.com.au
Thanks, Vladimir _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Hi Vicente, This review has been added to the queue. Cheers, ron On May 16, 2008, at 2:08 PM, vicente.botet wrote:
Ronald, please could you add this review request?
Thanks Vicente
----- Original Message ----- From: "vicente.botet" <vicente.botet@wanadoo.fr> To: <boost@lists.boost.org> Sent: Monday, April 28, 2008 11:14 PM Subject: Re: [boost] Review Request: Generalization of the Pimpl idiom
Hi,
this request do not figure in the review schedule. Have I mis a post?
Best _____________________ Vicente Juan Botet Escriba ----- Original Message ----- From: <Vladimir.Batov@wrsa.com.au> To: <boost@lists.boost.org> Sent: Monday, March 31, 2008 6:34 AM Subject: [boost] Review Request: Generalization of the Pimpl idiom
I hope I am following the submission procedure correctly. I read the guidelines and I seem to do what is needed. Apologies if I missed something.
The code is in the Boost Vault called Pimpl.zip It compiles with GCC 4.1.2 (I use it on Ubuntu 7.04) and MS Visual Studio 2005. Documentation is at DDJ site: http://www.ddj.com/cpp/205918714 Any questions/suggestions/critique - vladimir.batov@wrsa.com.au
Thanks, Vladimir _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/ listinfo.cgi/boost
participants (5)
-
Aaron W. LaFramboise
-
Mathias Gaunard
-
Ronald Garcia
-
vicente.botet
-
Vladimir.Batov@wrsa.com.au