On 1/21/2024 3:46 AM, Dom DiSc wrote:
`class-private` is superfluous cruft. You can very easy live without it.
And it has only no side effects, if it is implemented without `friend`s. But without this misfeature it is incomplete.
Therefor it was decided not to implement it.

It would be ok for me to add `class-private` as is, but only with the guarantee that `friend`s will never be added, no matter how much theĀ  people using it cry, because it is sometimes unusable without them.

The irony is that the presence of class private in C++ wound up motivating the friends feature, which violates private left and right. D did it right with module level privacy, which is enforced.

C++ private isn't private, const isn't constant, and one can throw from nothrow functions.

D users do ask for non-constant const, impure pure, and GC allocating @nogc. You *can* do these things in D by using forcible casts in @system code. The salient difference between that and C++ is that the D compiler still assumes those invariants are in force, whereas C++ compilers cannot.

Reply via email to