Safe Navigation Operator “?.” for D2 ?

Jacob Carlborg doob at me.com
Sat Mar 1 07:13:34 PST 2014


On 2014-03-01 14:54, Araq wrote:

> I could list the problems, but that would fill books. So, I'll focus on
> a single aspect instead here: "Favour composition over inheritance".
> This is commonly regarded as the better solution (and I agree with it
> btw). Ok, fine, so we favour composition and don't use inheritance. If
> we don't use inheritance we have no subtyping either (at least in the
> "classic OO model") and without subtyping we don't need dynamic binding
> either. In other words, we model things as nested structs plus
> functions. We can attach these functions to the structs or make them
> free standing but this is only a cosmetic detail really. So what's left
> of OO? Nothing! "Favour composition over inheritance" is a single big
> confession that OO doesn't work...

You have other parts of the OO paradigm as well, which I would consider 
more important:

1. Combining data (instance variables) and behavior (methods) as a 
single entity (object)

2. Encapsulation and information hiding

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list