What would be the consequence of implementing interfaces as fat pointers ?

Artur Skawina art.08.09 at gmail.com
Mon Mar 31 03:09:38 PDT 2014


On 03/31/14 09:28, Walter Bright wrote:
> On 3/30/2014 8:32 PM, Adam D. Ruppe wrote:
>>
>> structs can pretty easily be reference types too:
> 
> Or just:
> 
>    alias S* C;
> 
> Voila! Use C as the type instead of S*. 

   C c = ...;

   auto a = c[42];

Boom!

This is a catastrophic failure mode. Op overloads may be added to the pseudo-C
after it's already written and working, and then a) the bug might go unnoticed,
and b) fixing it requires API changes. See also my other reply.

artur


More information about the Digitalmars-d mailing list