On June 6, 2014 8:02:44 AM EDT, Vladimir Batov
Rob Stewart-6 wrote
... On June 6, 2014 4:59:47 AM EDT, Vladimir Batov <
vb.mail.247@
> wrote:
... my offering of pimpl::pointer_semantics and pimpl::value_semantics seems to make sense.
That's the problem. It isn't the Pimpl Idiom anymore.
Well, that was a few nervous hours when I felt my familiar Pimpl world was crashing all around me... after looking closely it seems my "extended" interpretation of Pimpl to still be the Pimpl Idiom. :-) First, Pimpl == Handle/Body == Bridge.
Assertion
Now I open GoF pg. 151 -- the Bridge chapter.
The Applicability section -- you want to share an implementation among multiple objects (perhaps using ref. counting).
[snip]
The Implementation section -- 3. Sharing implementors.
In fact, the Implementation section goes as far as to call one-to-one relationship between Abstraction and Implementor a degenerate case of the Bridge pattern.
I.e. Gof sees pimpl::pointer_semantics, a.k.a. "Bridge with Shared Implementation" to be the proper Bridge when pimpl::value_semantics to be a degenerate one... although I feel it's a "bridge" :-) to far.
Conclusion If one accepts the assertion that the Pimpl Idiom is the Bridge Pattern, the conclusion is appropriate. I don't accept the assertion. That is, the Pimpl Idiom is the degenerate case, but it isn't the same as the Bridge Pattern.
Do I get a cookie? :-)
If your proposed library is named Boost.Bridge, for example, both forms fit. I'd still provide a pimpl class template, however. ___ Rob (Sent from my portable computation engine)