[C++-sig] multiply defined to_python_converter

Langston, Matthew David langston at SLAC.Stanford.EDU
Thu Dec 12 21:54:58 CET 2002


Dave Abrahams wrote:

> I think Ralf and I are now agreeing on a scheme something like the one he
> suggests above.  I don't think we can use scope() exactly, but the
> following should be possible:
> 
>   * Conversions registered in by the current extension module will
>     always be used in preference to those registered by any other
>     extension module [but see note below]
> 
>   * If no conversion is found in the current extension module, the
>     fallback is to search converters associated with its parent in the
>     package path, and so on, until the package path is empty.
> 
>   * If at this point no eligible conversion is found, the global
>     conversion registry is searched.
> 
> [snip]
>
> The key question is whether two extension modules can end up with separate
> copies of the same static member of a class template:
> 
>        template <class T>
>        struct test { static int x; };
>        template <class T> int test<T>::x;
> 
> Now when you change test<int>::x in one extension module, does another
> extension module see the same value?  We want the answer to be NO in order
> to allow some conversion scoping.
>
> How does this sound to everyone?

I'm not sure I understood the case for why two extension modules need separate
copies of a static member of a class template. Is this an intenal Boost.Python
implementation issue that is required to implement your three-point plan above?
Or, does it relate to user-written to_python_converters?

Based on my use-case, the solution you and Ralf came up with completely solves
my problem. So, how does it sound? Sounds perfect to me.

-Matt






More information about the Cplusplus-sig mailing list