On 5/12/07, Gustavo Carneiro <gjcarneiro@gmail.com> wrote:
On 12/05/07, Roman Yakovenko <roman.yakovenko@gmail.com > wrote:
On 5/12/07, Gustavo Carneiro <gjcarneiro@gmail.com> wrote:
>   Sometimes Py++ _knows_ a method won't compile, but tries to bind it anyway.  This can be bad when you have developers adding C++ methods and not aware or not caring about Python bindings; sometimes they add methods that won't compile. 

>Not to mention that is a pain to have to manually exclude the methods that won't compile.

Why? I think Py++ provide a convenient interface for such things.

  Yes, Py++ provides the best possible interface for everything.  But sometimes no interface at all is even better ;-)

I agree with you.

>   Couldn't Py++ just not bind methods that will not compile for sure?

Yes. Today every declaration has "exclude" method. I will add new argument - "declarations_that_cause_compile_time_errors_only" ( please give a better name ).
You will have to set it to "True". The function will write to the log all declarations it excluded.

I guess you don't want to exclude function that missing call policies, right?

  Yes, missing call policies is what usually hits me.  I am not sure if there are other cases when Py++ definitely knows the generated code won't compile...

Yes it knows: http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pyplusplus/messages/warnings_.py?view=markup some of the warnings related to functions.

Also you don't have to wait for the patch - you don't need one

mb = module_builder_t(...)
mb.calldefs( lambda calldef: calldef.call_policies is None ).exclude()

This will work for your version of Py++

The way I am going to implement this is to check messages reported by "readme" method, to find all those I will define as problematic and exclude the declarations.

P.S. I am a little bit busy these days, can you add new "feature request" to the project? Thanks.


  I should try to produce a patch, I guess... :P

No, let me to handle this :-)

  PS:  0.9 was a _great_ release; it even produces code that compiles fine with "off the shelf " Boost 1.33.1.  That is a great thing; thank you so much :-)


Roman Yakovenko
C++ Python language binding