Why D is annoying =P

Era Scarecrow rtcvb32 at yahoo.com
Wed Oct 24 19:46:04 PDT 2012

On Thursday, 25 October 2012 at 02:19:39 UTC, H. S. Teoh wrote:

> Huh? Why would you drop classes in favor of structs? They are 
> used for two different purposes. Classes are for when you need 
> polymorphism: inheritance, overloading, interfaces, all the 
> trappings of OO programming. Structs are for when you need 
> value types that doesn't need OO-style manipulations. Not the 
> same thing.

  Indeed. Instead of interfaces you'd use templates, OO doesn't 
change really all that much. There's also large amounts of memory 
consumption  that just isn't needed for data that hasn't and/or 
isn't going to change. More often I'm thinking structs 
w/templates are more powerful than classes.

  I'm experimenting with a polymorphic struct. Run-time price is a 
couple enum checks if there's multiple functions that might 
qualify, and slightly different calling for those polymorphic 

More information about the Digitalmars-d mailing list