Can we just have struct inheritence already?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Jun 10 08:43:15 UTC 2019


On Sunday, 9 June 2019 at 22:13:51 UTC, Manu wrote:
> And here's the thing... this code ALREADY EXISTS in effect, 
> except that it's way more hideous, and pointlessly aggravated 
> (for the list of reasons above)!

Yes, I agree that reasonable ways of composing datastructures  
should be readable at a glance and shared across all programs. So 
metaprogramming solutions that does not make code legible is not 
a good answer.

For instance, mixins are good for adding "interface like" 
methods, but if you start using it fore general composition then 
we are back in macro-land where everything is possible, but 
intent is indistinguishable. The code will start to look like a 
soup of syntax…

By using macroish features then you cannot easily grasp the 
intent.
With inheritance the intent is crystal clear, even for newbies.

Absolutely.




More information about the Digitalmars-d mailing list