Boost logo

Boost :

Subject: Re: [boost] [interfaces] Boost Interface Library (2004?)
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-02-06 21:27:39


On 2/6/2011 8:01 PM, Daniel Larimer wrote:
>
> On Feb 6, 2011, at 5:58 PM, Edward Diener wrote:
>
>> On 2/6/2011 4:18 PM, Joaquin M Lopez Munoz wrote:
>>> Edward Diener<eldiener<at> tropicsoft.com> writes:
>>>
>>>>
>>>> On 2/6/2011 3:07 PM, Daniel Larimer wrote:
>>>>> I recently ran across the unofficial Boost Interface Library
>>>>> (http://www.coderage.com/interfaces),
>>>>
>>>> How are is an interface any different than a C++ abstract class ?
>>>
>>> As the concept is defined by the aforementioned library,
>>> interfaces allow for dynamic duck typing.
>>
>> It is not your problem but I did not get much of an understanding from the OP's original description of what advantages his implementation has over using C++ abstract classes to define interfaces. In other words what duck typing has to offer in terms of use which makes it better.
>
> It is not always possible to change the inheritance hierarchy of other types that you want to use in a polymorphic way. Sometimes you need to add a polymorphic interface to a class that you do not want a vtable for. Every method in an abstract class becomes a virtual dispatch even when most use cases do not require or cannot benefit from virtual dispatching.

So you want the effective of an abstract class without the virtual methods ?

>
> All of those reasons aside, my interest in the subject is because I want to dynamically create stubs for RPC, scripting, etc and there is no way to do that via an abstract class.

There is nothing on the C++ standard about RPC stubs so when you say
that there is no way to do that from an abstract class you must be
referring to some 3rd party library you are using.

I have dealt with RPC in a project I once worked on for Hewlett-Packard
but I admit I no longer remember how the IDL was created, or even if it
was done manually or programatically.

In any case I encourage you to explain the use case(s) of your library
as carefully as you can in order to get others interested in it.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk