3 ms·
For once, just once, I would like to see someone compare apples to apples: OO vs corresponding encapsulation techniques in functional languages (abstract data t
by jganetsk 18y ago
For once, just once, I would like to see someone compare apples to apples: OO vs corresponding encapsulation techniques in functional languages (abstract data types, ML-style modules/functors, Haskell-style typeclasses).
In case anyone was wondering, yes, the functional community loves namespacing, encapsulation, and creation of new data types with functions specifically intended for use on them.
The real question is: How do we express relationships between data types...
Do we use subtyping? (OO yes, functional no).
How do we allow multiple types to see each others privates? (Friends/inheritance in OO, modules in Haskell and ML).
How do we do polymorphism over static data/functions? (Basically, doesn't exist in OO... functors in ML and typeclasses in Haskell).
The immutability debate is another discussion entirely.