[C++-sig] [Boost.Python v3] Features and Scope

Stefan Seefeld stefan at seefeld.name
Mon Aug 29 02:13:50 CEST 2011


On 08/28/2011 02:39 PM, Dave Abrahams wrote:
> on Sat Aug 27 2011, Stefan Seefeld <stefan-AT-seefeld.name> wrote:
>
>
>> Binding converters to particular modules (and requiring to explicitly
>> import / exporting converters) seems like a solution to the above.
> It might be, but your description of what you're actually proposing is
> pretty vague, still, so it's hard to tell.

I haven't fully thought this through myself yet. In terms of UI I
imagine this to work like this:

  import ext_mod

would still keep the converters private to ext_mod by default, so only
functions and methods from ext_mod itself would have access to it. To
make those converters accessible globally would require an extra step,
for example:

  from ext_mod import __converters__

Thus each python module can decide itself whether or not it wants to
access them.

Implementation-wise this would imply that a single global registry would
be replaced by a linked list of per-module registries. The obvious
disadvantage is that converter lookup will be relatively slow.

There could still be ways to keep the current behavior, both for
backward compatibility but also as an optimization, if the author knows
that there is no danger of symbol collision.

    Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list