Am Sonntag, den 28.08.2011, 11:31 +0200 schrieb Andreas Rossberg:
> 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.

Who says that the state is or can be hidden? This is certainly a later
addition to OO, when people found out that they can view a class as an
abstract data type (with the known limitations). Take off your "typed
glasses". OO is mainly a way of organizing the execution flow, and there
are lots of OO languages lacking typing and access control. And even in
OCaml you'd not use objects if your primary interest is encapsulation -
objects are not good at this. (That's all what I'm saying!)

Gerd

> 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
> 
> 

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    [email protected]
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
*** Searching for new projects! Need consulting for system
*** programming in Ocaml? Gerd Stolpmann can help you.
------------------------------------------------------------


-- 
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

Reply via email to