[C++-sig] constructor wrappers?

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu May 30 23:00:52 CEST 2002


--- David Abrahams <david.abrahams at rcn.com> wrote:
> I understand that your solution works for your problems.

How about giving me some credit for being a heavy user of Boost.Python?
Don't you think that many of my experiences are representative?

> I think of the derived class wrapper approach as a kludgy workaround,
> not a solution. I'm in favor of a lighter-weight alternative, but I
> also want it to be efficient and flexible. In library design you often
> have to be careful to get the interface right the first time, because
> you're stuck with the results essentially forevermore.

Yes. But if you had taken that philosophy too far would there be Boost.Python
V1? (with the returned reference problem, the friend function hack, and the
incomplete cross-module support.) It still is a great, ground-breaking library.

> > For a start I would be happy with the famous "70% solution." Add
> > more sophistication depending on user demand.
> 
> Of course you would, but then you won't have to explain to other users
> why lightweight constructor wrappers cause them to make a copy of the
> std::vector<> they are wrapping ;-)

This is going in the wrong direction. Now let me be on the other side of the
fence (striving for ideal solutions): The combination of std::vector and
Boost.Python is a major PITB. It was so painful that I wrote a fully fledged
reference counted array type. This clearly is the right solution.

Under the assumption that the proposed 70% solution can be achieved in 20% of
the time required for the 100% solution, I am happy to explain that the
instances get copied.

Ralf


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com





More information about the Cplusplus-sig mailing list