How high level is D?

Neia Neutuladh neia at ikeran.org
Wed Nov 21 16:48:29 UTC 2018


On Wed, 21 Nov 2018 16:30:30 +0000, Meta wrote:
> On Wednesday, 21 November 2018 at 10:27:11 UTC, NoMoreBugs wrote:
>> Well, at a high level, D does support the notion of a class.
>>
>> However, D does not treat a class as an isolated conceptual unit (a
>> type).
>>
>> You can pretend a class is such a unit however, by isolating it within
>> its own module.
> 
> What? D certainly does "treat classes as types". Every class in D is its
> own type and supoorts the reguar methods of encapsulation as you would
> expect. The only difference is that in D, private class members and
> methods are module-public, meaning that anything else in the module can
> freely access them. That does not break encapsulation by any means,
> however.

NoMoreBugs and their 4-5 other aliases are extremely annoyed at D's 
`private` being private-to-the-module, like a third of programming 
languages, instead of private-to-the-type, like a different third of 
programming languages. It's apparently far too much work to put a type in 
a different module from code that shouldn't be able to access its private 
members.


More information about the Digitalmars-d mailing list