How high level is D?

Kagamin spam at here.lot
Thu Nov 22 08:42:13 UTC 2018


On Thursday, 22 November 2018 at 00:14:40 UTC, NoMoreBugs wrote:
> (1) - it's just plain fact (i.e. the private state of a class, 
> within a module, is not really private at all)
>
> (2) - its' completely unlike what a C++/Java/C# programmer 
> would expect (the 3 most widely used languages).

Encapsulation is usually used to provide interface to library 
consumers, it doesn't serve much purpose inside the library. 
AFAIK java has a restriction 1 class per file, which would work 
the same in D, in C# it's also a recommended convention. Also 
there's a use case when a class has a lazily initialized field 
that shouldn't be accessed directly, but through a property, but 
there's no way to do it because the class can access its private 
fields, traditional access attributes won't save you there.


More information about the Digitalmars-d mailing list