> Access modifiers were originally invented in Simula. As far as I can tell from extensive research, the inventors and users at that time simply didn't realize that access modifiers duplicated the interface-defining features that were already available: virtual methods and subtyping, which together are sufficient to define interfaces in Simula.
Simula was designed in the '60s. Public methods are still static, which mattered a lot back then. An 00s language like Java can take vtable hits for granted, but in the 60s that price was too high.
Anyway, interfaces and visibility serve different purposes. Interfaces exist so the caller can abstract over multiple implementations of a particular behaviour. Private methods exist for the callee's sake, to protect its internals from misuse that might violate invariants.
This is why languages like Go and Rust can comfortably define privacy at the module level—something that would make much less sense for interfaces—and why a language like python needs private methods (or, at least, _courtesy_private and __mangled_private methods) even though it has no interfaces.
> Simula was designed in the '60s. An 00s language like Java
Not that it is a big deal, but Java is a 90s language, not 00s.
> This is why a language like python can have private methods (or, at least, _courtesy_private and __mangled_private methods) but no interfaces
Interfaces are a feature of typing, and Python has them for both runtime (abc) and statically-checked (protocol) typing.
Java 1.0 was in '96. I had remembered it as being more like '98, which was why I said 00s and not 90s—1998 felt a bit late to really be "90s" for me.
I wouldn't really call abstract classes interfaces. They're a way to spread behaviour across an inheritance hierarchy, but a fully abstract class doesn't do anything. Python is duck-typed; inheriting from a fully-abstract class is a no-op unless you're doing something metaprogrammy.
- [deleted]