Re: Registries [2]

David Abrahams <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Message-ID <[email protected]>
This seems to me to be the killer argument against having any implicit
imports of from-xxx converters.  No?

Daniel Wallin <[email protected]> writes:

> At 21:51 2003-07-30, David Abrahams wrote:
>>Daniel Wallin <[email protected]> writes:
>>
>> > At 21:45 2003-07-29, David Abrahams wrote:
>> >>Daniel Wallin <[email protected]> writes:
>> >>
>> >> > At 18:42 2003-07-29, David Abrahams wrote:
>> >> >>Daniel Wallin <[email protected]> writes:
>> >> >>
>> >> >> > I'm starting to doubt our motives for local registries altogether, I
>> >> >> > might be forgetting something or I might be drunk, but right now it
>> >> >> > seems to me that we'd be better off with only a global registry. I
>> >> >> > just can't think of any cases where there would be interest in hiding
>> >> >> > converters.
>> >> >> > This is quite a turnover for me, so if someone could convince me
>> >> >> > that there are benefits with local registries I'd be glad. ;)
>> >> >>
>> >> >>Consider: one extension is converting std::vector<int> into native
>> >> >>tuples, and another has exposed a class_ wrapper.
>> >> >
>> >> > Right, but that only justifies local registries of to_xxx converters.
>> >> > Any reason to have the from_xxx converters local as well?
>> >>
>> >>People like to put C++ code in the global namespace and might have
>> >>name collisions (?)
>> >
>> > Right, but with automatic importing they would be screwed anyway.
>>
>>Not if the automatic imports had a lower priority than the others, right?
>
> Yes, if the local converters with higher priority doesn't match and there
> is a true collision between different types. Consider:
>
> module X
>    struct A { std::string x };
>    converter from lua/python string -> A
>    f(const A&);
>
> module Y
>    struct A { int x };
>    converter from lua/python number -> A
>    f(const A&);
>
> Y.f("foo")
>
> ---
> Daniel Wallin
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.