Can we just have struct inheritence already?

Ethan gooberman at gmail.com
Tue Jun 18 10:34:06 UTC 2019


On Tuesday, 18 June 2019 at 09:15:42 UTC, Walter Bright wrote:
> On 6/12/2019 11:29 PM, Manu wrote:
>> There's also ABI compatibility with existing C++ where this is
>> super-common. Consider that user-supplied <Allocator> is a 
>> base of
>> every STL container, that's one case where I've had to deploy 
>> the
>> static if hack a lot.
>
> Have you considered using template mixins? Since you're using a 
> base struct merely as a namespace for some functions, that 
> should work.

The ABI compatibility point really needs to be reiterated here. 
If the end goal, especially with things like D++, is to drive 
adoption of D by ensuring C++ interop is simple then that's now 
going to result in a static analysis tool to look at any given 
C++ struct and work out whether it should or shouldn't be 
converted to a mixin template. And introduce the dissonance of a 
C++ type not actually being a type in D.


More information about the Digitalmars-d mailing list