[C++-sig] multiply defined to_python_converter

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Wed Dec 11 19:11:43 CET 2002


--- David Abrahams <dave at boost-consulting.com> wrote:
> In Boost.Python v1, all conversions were "aggressively local".  The
> only way to export them was through a relatively cumbersome explcit
> construct in both the exporting and importing modules (No offense,
> Ralf)!

"Explicit is better than implicit."

> One thing I worry about a little is that we might have gone
> too far in the direction of automatically publishing all conversions
> for v2:

I think we definitely did go too far. The more I think about it the more I am
surprised that we missed this important point until now.

Your import<> idea looks interesting. Here is another wild idea:

Tie the conversions to scope(). If a function is def'ed in scope a.b.c look for
conversions in c first, then b, then a. It's not clear to me what to do about
cross-package conversions. Maybe one could use a special module-level variable,
like

import other_module_1
import other_module_2
__boost_python_conversion_path__=[other_module_1, other_module_2]

To support this the registry would have to keep track in what scope each
conversion was registered. However, the current C++ interface could maybe left
untouched.

Ralf


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com




More information about the Cplusplus-sig mailing list