Hacker News new | ask | show | jobs
by pyjarrett 841 days ago
My favorite thing about Ada is how it uses modules ("packages") for encapsulation and not classes. This separates it from a lot of other languages with object-oriented programming by allowing you to split up and expose externally visible behavior in modules and submodules without making type internals visible, but allowing other elements in the implementation side of the module and submodules to look inside.
3 comments

Most languages with OOP also do modules, all the way back Simula and Smalltalk started to influence Mesa/Modula-2 derived languages.

Additionally in a somewhat naive ways, classes can be seen as extensible modules, which in the presence of generics is less required as in languages that don't support them.

When using something like Standard ML functors, classes aren't really needed.

Yes, they are "officially" ML (no, not that ML) style.

https://ada-lang.io/docs/learn/why-ada#feature-overview

The explicitly specialised generic packages are nice too