
On Tue, Mar 23, 2010 at 6:56 PM, Stefan Seefeld <seefeld@sympatico.ca> wrote:
On 03/23/2010 09:47 PM, Emil Dotchevski wrote:
In many cases, I'd rather design a C-style interface that takes pointers to incomplete types or even void pointers. Then *maybe* if it makes sense I would use meta-programming tricks in the implementation.
I wonder how that goes together. Once you start using "pointers to incomplete types" etc., you have given up valuable (type) information
...and I have not paid the price for that information: physical coupling!
which you can not gain back "in the implementation". So what meta-programming tricks are there left to play ?
Pointers to incomplete types are type-safe but yes, in general, I'm talking about balancing compile-time type safety and physical coupling. The "proper" way to do this in C++ is to use abstract base classes; except that an interface defined in terms of C-style functions is more abstract than a C++ abstract base class because calling a C-style function doesn't necessarily result in a virtual function call (yet it *can* call a virtual function internally, if that makes sense.) Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode