What would be the consequence of implementing interfaces as fat pointers ?
Orvid King
blah38621 at gmail.com
Sun Mar 30 20:17:39 PDT 2014
On Sun, 30 Mar 2014 00:11:50 -0500, Walter Bright
<newshound2 at digitalmars.com> wrote:
> On 3/29/2014 8:38 PM, Daniel Murphy wrote:
>> "Walter Bright" wrote in message news:lh83dr$6m1$1 at digitalmars.com...
>>
>>> On 3/29/2014 8:26 PM, Daniel Murphy wrote:
>>> > It could, but we don't have a stable ABI
>>>
>>> ? The ABI for interfaces hasn't changed in many years. In fact I don't
>>> even
>>> remember changes in it.
>>
>> I meant stable in the sense that we _can't_ break it, not that we
>> _haven't_
>> broken it recently.
>>
>> ie we don't guarantee binary compatibility across releases.
>
> ok.
Actually, there is one big thing that this would break; C++ interop. With
the way interfaces currently work, you can define an interface with
virtual methods, and you can call those methods on that interface, and, if
you've properly overlayed it over a C++ class instance, you will be
calling a virtual method defined on that C++ class. Fat interfaces would
break this capability, and would actually break some of my existing code,
due to the fact I use that exact capability. I do however mark my
interfaces as extern(C++), so perhaps they would have to be an exception
to the ABI if this change were made?
More information about the Digitalmars-d
mailing list