Code That Says Exactly What It Means
Walter Bright
newshound2 at digitalmars.com
Tue Oct 28 08:37:46 UTC 2025
On 10/27/2025 11:47 PM, Peter C wrote:
> The internal state of this type, in D, 'automatically' leaks into the rest of
> the module.
Yes. If you want to hide the internals of a class, put it in its own module. The
"friends" then can no longer access the internals.
> So what's the problem then?
Every feature adds complexity. At some point, the language becomes unwieldy,
where nobody knows the entire language, and people use only islands of it (see
C++). Maintaining a language is always a battle with complexity. Having too many
ways to accomplish the same goal is not very desirable.
Your proposal does indeed have merit. But is it a big enough to justify a new
keyword, and more documentation? The more pages a language spec has, the fewer
people will read it. People love languages that can do a lot with very few
pages. You could learn C in an hour reading K+R. I remember when Go was
introduced and people loved that they could learn Go in just one lecture.
It needs more to justify it.
P.S. The major driver of the new "editions" feature is to enable us to remove
features that do not carry their weight, and that have easy alternatives. It's
not that they are useless features. It's just that features should have a big
impact. For example, Manu and Timon convinced me that placement new would have a
substantial impact on what could be done with D.
P.P.S. I do appreciate the time you took to present your proposal. You've
thought it out well. Thank you!
More information about the Digitalmars-d
mailing list