Re: Re: abstract unified interface

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Message-ID <[email protected]>
David Abrahams wrote:
> Daniel Wallin <[email protected]> writes:
> 
> 
>>I'm thinking we might need to make some decisions on the abstract
>>unified interface thing since it will surely affect how everything else
>>works.
>>
>>We need some ideas on how policies could be written language
>>independently. One thing to notice here is that the conversion work will
>>be done before any of the compile time generated converters get a chance
>>to do anything. So I'm thinking maybe the callpolicies could get a
>>chance to modify the function signature before the type_info's are
>>produced.
>>
>>I think many policies could be expressed this way, for instance..
>>
>>   void f(const int*, int size);
>>
>>Could be transformed to:
>>
>>   void f(array_with_size<const int, int>);
>>
>>Given that the language backend has a converter registered for
>>typeid(array_with_size<const int, int>), 
> 
> 
> 
> Seems reasonable
> 
> 
>>which is of course somewhat of an problem.
> 
> 
> Why?

Because you'd have to explicitly register conversions for all
combinations of the template parameters (well, not all.. but at least
the once that you use). With compile time generated converters that are
language dependent these kind of things are more convenient.

This would maybe include things like transforming:

   f(T*) [ adopt(_1) ]

to

   f(adopted_pointer<T>)

I don't know.. I'm just throwing out ideas here. There are some policies
in luabind which I'm not sure can be done this way.. For instance we
have a iterator_policy, which can handle conversions from stl containers
to an iteratable sequence in lua. I think BPL has something similar (?).

-- 
Daniel Wallin



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
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.