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:
> 
> 
>>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). 
> 
> 
> I would want to transform as much as possible (e.g. the size of that
> array) into runtime values, wouldn't you?

Sure.

>>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.. 
> 
> 
> Really?  I wouldn't have thought so.  I'd just build an AST of the
> policies on the registration side and walk it with a visitor inside
> the language-specific component.  Am I missing something?

I don't know. You would visit the policies at init time and setup some
function pointers or whatever to do the actual policy calls at runtime?
Can you elaborate?

-- 
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.