[C++-sig] Pyste bug: can't set different return policies on method

Nicodemus nicodemus at globalite.com.br
Sun Sep 21 19:32:52 CEST 2003


Niall Douglas wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>In a class like as follows:
>
>class FXFile
>{
>   const FXString &name() const;
>   static FXString name(const FXString &file);
>};
>
>Pyste gets the two name()'s confused and tries to apply 
>return_internal_reference to both. If I try to override and set one 
>of the name()'s to something different, the pyste syntax doesn't let 
>me.
>
>Solutions? I figured I can temporarily 
>return_value_policy(manage_new_object)) but in other situations this 
>wouldn't be possible.
>

That's a limitation of Pyste right now. One of the future plans is to 
allow metaprogramming inside the pyste files, which would allow you to 
do something like this:

FXFile = Class(...)

if not FXFile.name.static:
    set_policy(FXFile.name, return_internal_reference)

But this might take a while to be implemented... I haven't had much time 
to work on Pyste lately. But what you think of this solution?

Regards,
Nicodemus.





More information about the Cplusplus-sig mailing list