Code That Says Exactly What It Means
Kapendev
alexandroskapretsos at gmail.com
Thu Oct 30 13:20:34 UTC 2025
On Thursday, 30 October 2025 at 06:21:41 UTC, Peter C wrote:
> And for those that argue.. well .. in Ada.. packages are the
> unit of encapsulation too.. so what's the big deal with D
> having choosing to have the module as the unit of encapsulation?
>
> I'd answer: it is very likely, that if Ada were designed today,
> in a world dominated by class-oriented programming, the
> designers would likely blend the two models:
>
> - Keep packages as the unit of modularity.
> - Give types the ability to maintain their own encapsulation
> boundary (so invariants are truly type‑owned) - ( which is what
> a 'scopeprivate' like attribute .. would do).
>
> Then D would align with the modern 'a class maintains its own
> invariants' model.
There is nothing modern about this. It's just a *preference*
thing.
Also, did you ask the Ada devs whether they would even want that?
Sure, it's an old language, but that doesn't mean much.
More information about the Digitalmars-d
mailing list