What would be the consequence of implementing interfaces as fat pointers ?
deadalnix
deadalnix at gmail.com
Sat Mar 29 18:11:30 PDT 2014
On Sunday, 30 March 2014 at 01:04:27 UTC, Walter Bright wrote:
> On 3/29/2014 5:57 PM, deadalnix wrote:
>> All is in the title.
>>
>> This is becoming increasingly the norm in new languages. It is
>> much better in
>> term of performances (it avoid cascaded loads to call methods,
>> which can be
>> really costly on modern CPUs), make object themselves smaller.
>>
>> Would implementing them that way break D code ? What would be
>> the extent of the
>> breakage ?
>
> D already has phat pointers - that's what delegates are. I'm
> curious how the scheme you propose is different?
I'm talking about interface here. The way they are implemented in
most new language is via a struct that contains:
- pointer to the object
- pointer to vtable
That way to don't make object bigger when they implement an
interface, and you don't need cascaded load to call methods.
More information about the Digitalmars-d
mailing list