Why can't we have compatible C++ name mangling and/or introspection/reflection such that we could write an FFI library for C++ similar to ctypes for C?
Dr. Stroustrup seemed to be of the mind that there is no technical reason not to be able to do it, but that the individual compiler writers and platform developers have a strong vested (perceived) interest in keeping their proprietary and incompatible name-mangling and linking schemes. In other words, the blocker for an elegant, standard C++Types implementation is politics, not technique... unfortunately, politics of a scale way beyond reasonable effort for the return on investment (think 10 years of lobbying and vested interests (however speciously) claiming billion-dollar price-tags for any changes).
Which means to do a portable C++Types we'd have to work around the C++ peoples, making some sort of mechanism that would allow us to discover the run-time structures created from a given piece of code in order to find the entry points we need (and their meta-data). It would be so much nicer if there were an ILR-like metadata production mechanism that could be spit out by all of the C++ compilers to describe the code they've generated.
In other not-really-news-but-news-to-me C++0x is going to get a facility that looks a lot like compile-time python-style interfaces (capabilities). You have capability templates that are used to specify types of arguments and then you have capability mappings that specify how a particular class/template implements that capability (an adapter in interface-speak).
Seems rather elegant for what it is, particularly as it all fits nicely with static analysis to allow the compiler to reduce it all down to concrete code, doing all of the adaptation at compile-time. Don't feel a burning need to switch to C++ for my coding needs, but an interesting evening nonetheless and it twitched the old itch to play around with PyPy again.
Pingbacks are closed.