Hiding class pointers -- was it a good idea?

James Dennett jdennett at acm.org
Sat Aug 18 07:57:39 PDT 2007


Tristam MacDonald wrote:
> Alex Burton wrote:
>> Walter Bright Wrote:
>>
>>> 1) inheritance
>>> 2) polymorphism
>>> 3) encapsulation
>>
>> Another one in that list should be "reference", which IMO would be
>> assumed by most people, but has been lost with transitive const in D.
>> I would define it as the ability to not encapsulate something a class
>> has a reference to.
>> By making all objects that an object has references to necessarily
>> part of that object, the transitive const feature means that the only
>> state relationship a class can have to another class is encapsulation.
>>
>> Correct me if i'm wrong :)
>
> Agreed, but I can't think of another language that supports this
> definition of OOP (apart from 'mutable' under C++ - which is widely
> regarded as a hack).

About every OO-aware language but D supports it; only D
(2.0) assumes in its type system that reference to another
object always implies a whole-part relationship between
them.

"mutable" isn't much related to this (and note that widely
held opinions are often not shared with informed experts).

-- James





More information about the Digitalmars-d mailing list