D modeling

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Thu Jul 4 04:33:12 UTC 2019


On Wednesday, 3 July 2019 at 19:31:49 UTC, Bert wrote:
>
> The problem with removing the interfaces is that when you try 
> to extend the model by adding new classes you will then have 
> multiple inheritance of classes and be screwed. You may be able 
> to remove them in the simple example I gave but in general it 
> will be impossible to make it work. One of the main reasons for 
> interfaces is precisely to allow MI in a single inheritance 
> language. The interfaces are the only way to avoid such future 
> problems. In essence you are creating an anti-pattern.

Huh, not sure what is up with that:
https://gist.github.com/run-dlang/bfc043093066da04f0d2bec5a07de459

I understand the purpose for interfaces, what I'm trying to 
understand is your requirements for this 'model' idea.

Your code made overzealous use of inheritance which I expect 
created some of your frustration. When I stated I did not see 
multiple inheritance in your code, you pursued it was and the 
interfaces were required. I have shown this is not true, so I ask 
you to consider what your needs actually are. I'm not creating 
any patterns I'm informing you of how the language works and 
meets your demonstrated need.


More information about the Digitalmars-d mailing list