Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-04-27 07:48:32


"Thorsten Ottosen" <nesotto_at_[hidden]> writes:

> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
> news:099701c54ab2$8f8fb080$6401a8c0_at_pdimov2...
> | Thorsten Ottosen wrote:
>
> | > I think you have to explain why they are not different then.
> | The burden of proof lies usually with the person making the
> | statement. ;-)
>
> no, the burden of proof lies on the person making the controversial
> statement; in this case you.

Controversialness is in the eye of the beholder, and regardless,
Peter's right: by convention, the burden of proof lies with the
claimant. That's very practical, because if you're saying something
so obvious and "uncontroversial" it should be very _very_ simple to
demonstrate it.

> stuff like "value-based programming is not different from
> OO-programming"

Nobody made that statement.

> just seems weird to me; we probably won't get
> anywhere before we can agree on how to define these two terms.

That's a good idea. Since you introduced the terms, it seems to me
that it's on you to define them and explain why they're different.

> | The reference semantics vs value semantics axis is orthogonal to OO,
> | in my opinion. The fact that in C++ you can't (efficiently) have
> | polymorphism with value semantics doesn't mean that copying a value
> | and copying a polymorphic object are conceptually or fundamentally
> | different. A cloning pointer is a very good approximation of a
> | polymorphic value. I don't see why you consider it conceptually
> | different from a value.
>
> because you had to put "polymorphic" in front of "value" to describe
> what it means;

The user can't tell a Pimpl with a polymorphic impl from one without.
They both just look like values, and all those behavioral variations
that are implemented with virtual functions could just as well be
implemented with "if" statements. Nobody (except maybe you) has a
problem with allowing pimpls to have copy ctors -- impls often have
clone() functions just to serve those copy ctors. A ptr_container is
almost exactly like a multi-pimpl or a pimpl aggregate.

> polymorphic objects don't have value-based copy-semantics; you can't
> provide meaningful copy-constructor and copy-assignment operators.

Sure they do. You only can't provide a meaningful copy ctor and copy
assignment for an abstract base class.

> A "value object" implies something that behaves as an int; a
> "polymophic object" implies something that needs to allocated
> dynamically and which has virtual functions.
>
> trying to make a polymorphic object behave like a value object is
> confusing a best.

Pimpls don't confuse me. They "just work."

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk