3 ms·
In practice enforced privacy is rarely used in languages other than Javascript. In Java, C#, Ruby, Python, PHP advisory privacy is the default. You would enfor
by esailija 13y ago
In practice enforced privacy is rarely used in languages other than Javascript. In Java, C#, Ruby, Python, PHP advisory privacy is the default.
You would enforce privacy when you need to run untrusted code in same process (like the Servlets model), which is not the case in any Javascript application.
Enforced privacy in Javascript is also very inflexible, disabling many ways of extensiond and reuse and encouraging god objects because you cannot fine-tune the access - other internal "classes" are just as unpriviledged as some random application code.
So in my eyes there are plenty of downsides for no visible upside - in all other languages the developers seem to play well and not write code to access privates. Maybe that's due to incompetence though.