|
Boost : |
Subject: Re: [boost] 5 Observations - My experience with the boost libraries
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2010-03-23 22:45:50
On Tue, Mar 23, 2010 at 6:56 PM, Stefan Seefeld <seefeld_at_[hidden]> 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk