On Wednesday, 23 May 2018 at 02:23:31 UTC, Bjarne Stroustrup
wrote:
This is NOT why I created C++ - just so you programmers could
violate an objects autonomy!
So why did you create C++?
On the serious side though, unencapsulated software is
inflexible, and as a result, not very robust.
The reason the class is more encapsulated than the struct is that
more code might be broken if the (public) data members in the
struct change than if the (private) data members of the class
change.
There is a direct relationship between encapsulation (how much
code might be broken if something changes) and practical
flexibility (the likelihood that we'll make a particular change).
Now many of you may have heard my talks about 'Encapsulation and
Non-Member Functions'. Let me remind you all though, that I was
referring to non-member non-friend functions, not non-member
functions that can penetrate your objects private parts.
Penetration results in less encapsualtion, not more.
So I support your Bjarne. Something need to be corrected in D.