On Aug 28, 2011, at 01.08 h, Gerd Stolpmann wrote:
Let me point out one final thing. Information hiding is simply not a
core concept of OO - which is in the first place a specific way of
structuring the program (e.g. group data and algorithms together),
with
an integrated method of adapting object types (subtyping), and giving
control of parts of your algorithm to the user of your class.
Not sure why you would say that. I'd argue that information hiding
("encapsulation") definitively is very central to OO -- an object
collects a set of methods that operate on some hidden shared state
(not necessarily mutable). And Ocaml fully supports that.
What is not at the core of OO is the kind of ad-hoc softening of full
encapsulation introduced by access modes like "protected" or "friend".
And for better or worse, that's what Ocaml does not support directly
-- everything is either public or (instance) private, unless you
encode more sophisticated policies through the module system.
/Andreas
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs