private(this) vs LINT
The Zealot
zod at zod.zod
Thu Jun 30 11:36:01 UTC 2022
On Tuesday, 28 June 2022 at 22:03:54 UTC, forkit wrote:
> On Tuesday, 28 June 2022 at 20:58:56 UTC, Daniel N wrote:
>>
> Without something like private(this), hazardous interactions
> are inevitable, and will increase with scale (e.g. having 20+
> friend functions in your class ;-)
this is just not true. don't put the damm class in module scope
if you don't want it accessible.
It's just your unwillingness to adjust your programming to the
language that causes these problems. The language offers enough
tools to deal with it, you just don't accept them as valid,
because you are used to _your perceived correct way of proper
encapsulation_.
In reality the encapsulation boder is totally arbitrary. And you
have failed to even give one _real world_ example of a bug it
would have prevented.
In reality, noone is randomly accessing private state. It's a non
issue in languages that don't have the feature.
And im most cases i'd argue that private(this) would actually
enurage bad code design, so there is reason not to have it, like
goto.
Anyway, feel free to write a linter, i'm sure there are other
people who would apreciate it.
More information about the Digitalmars-d
mailing list