Re: [pygccxml-development] Basic Py++ questions
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2008-10-29 10:17:42
|
On Wed, Oct 29, 2008 at 11:38 AM, Paul Melis <pa...@sc...> wrote:
> Hi Roman,
Hello.
> Surprisingly you say that class_('mynamespace::C') might not match any
> class, as the following example line is in the query interface docs:
>
> do_smth = my_class.member_function( 'my_namespace::my_class::do_smth' )
>
> I suppose that this form should match something as it is basically the most
> used form in C++ code. I haven't seen much code that consistently uses an
> absolute namespace path, like ::mynamespace::C, to refer to classes.
Hmm. The functionality was implemented few years ago. I will create
tester which will show "the real behavior".
I will let you know the results.
> Right, I did notice the docs about this and saw a quote from you somewhere
> that it allows you to exclude items based on warnings they generate.
> The above indeed shows that, but the warnings API doesn't allow you to find
> WHICH items generated a certain warning so this would mean iterating over
> ALL items being exported and checking them for a certain warning?
You are right and this is the only solution. Not Py++, neither user
can implement such functionality efficiently.
Why do you want to exclude such declarations:
* to get "clean" build - without warnings. If so, in this specific
case you can decide that you trust Py++ and suppress the warning.
* other reasons - please explain.
>>>
>>> - Finally, if I .exclude() a certain class it seems that this doesn't
>>> propagate into excluding all methods/functions using that class (related
>>> to the previous question)?
>>>
>>
>> You mean you have class A{}; and some function f( A& ) and excluding
>> A, doesn't exclude f, right?
>>
>
> Yes. I'm not certain how the generated wrapper would behave when class A is
> excluded, but f(A&) WOULD be wrapped.
As warning says - you will get Boost.Python run-time error. It will
say that it can not invoke the function with the arguments you gave.
> If there was a class B derived from A that would be included in the wrappers
> then I could still call f(B)?
You should check, but if I remember right, you still can do this. It
is possible, that few functions defined in class A, will be redefined
in class B wrapper - for example pure virtual functions.
>>
>> If so, Py++ doesn't do it for performance\memory reasons.
>>
>> Now, when I think about it, it should be easy to add to the class_t
>> new function - "exclude_me_and_references_to_me" ( better name is
>> needed ) which will does exactly what you want. We can use
>> "i_depend_on_them" functionality.
>>
>
> It would be a nice addition to give users a choice of how exclusion of a
> class is treated. The current option is simply excluding only the wrapper
> for the class, but another variant would then be to exclude the class and
> all its uses.
I can do this. Please open the ticket on SourceForge.
> Regards,
> Paul
>
> PS Why did you choose to name classes with the "_t" postfix, e.g.
> declaration_matcher_t versus the more common/pythonic DeclarationMatcher?
This is the code convention I am used to. I am coming from C++ world.
> And could a statement like "if not None is self.decl_type:" not also be
> written as "if self.decl_type is not None:"?
It seems that this specific statement was written late at night :-)
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|