Re: abstract unified interface
David Abrahams <[email protected]>
| Newsgroups | gmane.comp.lib.boost.langbinding |
|---|---|
| Message-ID | <[email protected]> |
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? > 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'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 (?). We don't try to handle everything with a policy in BPL; this is one of those things, though a policy might be better. -- Dave Abrahams Boost Consulting www.boost-consulting.com ------------------------------------------------------- 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/