Algorithms should be free from rich types
Dom DiSc
dominikus at scherkl.de
Sat Jul 1 09:52:12 UTC 2023
On Friday, 30 June 2023 at 16:48:39 UTC, Meta wrote:
> IMO private is extremely important for maintaining the internal
> invariants of a unit of encapsulation.
Yes. And this is pretty much the only reason to use private.
You have functions that don't keep the invariants for performance
reasons, so you create public functions that call them in the
correct order and with the correct parameters to keep the
invariants.
So private is there, to hide unsafe interfaces, to prevent the
user of a library to mess up things.
If you want to be able to mess up things, any kind of API will
never be good enough for you - you simply need the source code
and modify it.
And then private won't hinder you - simply remove it.
More information about the Digitalmars-d
mailing list