Interface Limitations in D
Ogi
ogion.art at gmail.com
Mon Sep 20 11:45:06 UTC 2021
On Sunday, 19 September 2021 at 20:00:11 UTC, Elmar wrote:
> * **Non-polymorphic inheritance exists (`alias this` in
> `struct`s or `class`es) but no non-polymorphic `interface`s for
> structs**
>
> This one is most meaningful.
>
> In my current project in D, I'm working on a low or
> medium-low level and it's not suitable to use classes (they
> also need to work in Better-C). I don't need polymorphy. I only
> like to guarantee a **consistent** interface among my
> `struct`s. It makes life of users easier and prohibits others
> from "inheriting" my struct properties in unintended ways.
>
Sounds like what
[concepts](https://code.dlang.org/packages/concepts) package
does. Unfortunately, doesn’t work with BetterC.
More information about the Digitalmars-d
mailing list