On 9/21/06, Matthias Baas <ba...@ir...> wrote:
> > They should. Can you give me few good reasons to not create wrappers?
>
> Besides being an unnecessary layer of complexity that doesn't serve any
> useful purpose and just leads to larger source files and executables, it
> breaks my regression test.
I understand that you don't like them, but I ask you for reasons :-).
"unnecessary layer of complexity" all wrapper functionality for declaration
defined in class A could be found in A_wrapper.
"larger source files" - this way I think the generated source code is easier to
understand and explain
> It's the vector class again. This class has a couple of predefined
> vectors as static members such as, for example, "zero" which is the
> vector (0,0,0).
> Doing an operation such as adding two vectors doesn't work anymore if
> one operand is instantiated in Python and the other one is one of the
> above predefined vectors:
>
> a = Vector(1,2,3) # this will be a Vector_wrapper instance
> b = Vector.zero # this will be a Vector instance
> c = a+b # fails
>
> I don't know exactly what happens here inside Boost.Python, but my guess
> would be that the addition is only defined between two *wrapper* classes
> and not between a wrapper class and the original class.
>
> I've experienced such things before with other libraries which is why
> I'm only creating wrapper classes when it is absolutely necessary.
This is a valid point, that I should check.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|