Re: Conversion policies
David Abrahams <[email protected]>
| Newsgroups | gmane.comp.lib.boost.langbinding |
|---|---|
| Message-ID | <[email protected]> |
Daniel Wallin <[email protected]> writes: >>I confess, though, that I am really confused about where this is >>coming from, since I was sure you had agreed that "100% compile-time >>converters" are not worth their costs. > > Yeah you're right, I did agree to that. I'm just trying to clear > things up. ;) It is still unclear to me how runtime and compile time > converters will interact though Didn't we just say there weren't going to be any "compile-time converters?" Or did you mean something else? > like in the case of our "adopt" policy.. In luabind it's a > converter, in langbinding perhaps it will be a policy with a > post-call action which removes ownership instead. I don't know.. Err... I don't see how "it's a converter" vs. "it's a policy" is anything more than a name game. Ultimately it needs to do the same thing. As for whether ownership is removed post- call, it may be important to choose pre-call removal in case an exception is thrown from the call and the callee has already claimed ownership. >> > >> > The problem here is that the constructed temporary will be destroyed before >> > it's returned from object_cast<T>(). Given that object_cast<T> is >> actually a >> > function rather than a type with implicit an cast to T of course.. >> >>It's called "extract" in Boost.Python and >> >> 1. Yes, it's a type with an implicit conversion operator >> >> 2. Extraction of a reference to a temporary should fail at runtime > > Ok. Out of curiosity, why should it fail at runtime? Because we can't make it fail at compile time? It's clearly an error! >> >> > One thing that would be cool is if you would be able to chain >> >> > compile time selected converters with runtime dispatch >> >> > converters.. Something like: >> >> > >> >> > chain(my_policy(result), default_policy) >> >> > >> >> > So that several converters can be tried even if you use a policy. Am I >> >> > making sense here? >> >> >> >>Not yet. >> >>You gonna explain this stuff? > > Ok, I was just rambling about how compile time converters could > interact with runtime converters. Still very confused as to why you'd ramble about something that we're not doing (?) > I should have named "chain" "composite" instead; it tries all it's > converters and returns a best match, just like the runtime system > does. Most confusing. -- Dave Abrahams Boost Consulting www.boost-consulting.com ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0