logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Next Step: msg#00048

Subject: Re: Next Step
On Tue, 2003-10-07 at 08:02, Brian Hurt wrote:
> On Mon, 6 Oct 2003, Nicolas Cannasse wrote:

> > 
> > BTW, objects are certainly the worst part of OCaml. They are tricky,
> > difficult to use, and have bad performances (compared to modules instances).
> > If you look at Java programmers (or most of the OO programmers actually)
> > they're using OO only for prototyping ( interfaces in Java or pure virtual
> > classes in C++ ). In Ocaml , you can already prototype by using a module and
> > add specialisation with some polymorphic closures. Believe me : you don't
> > need objects.

Objects provide dynamic binding. When you have a suitable
application, they're useful for that. I used them well
in my Vyper emulation of Python for scopes (lookup contexts)
to abstract away the rather quirky lookup rules of Python.

Modules don't support dynamic binding so that wasn't an option.

> While I'll agree that Java programmers use objects for a lot of things
> that Ocaml has better ways of doing, I think objects are the *natural*
> representation for enumerations.  You have internal state shared among
> multiple functions (data hiding), multiple implementations of the same
> methods (inheritance), and a specified contract for the API (interfaces).  
> This is OO all over.

I don't think you mentioned the most important feature.
Enumerations are mutable, and objects provide a good way
to represent and control sharing. The same cannot be
said for, example, references (since the default, to
share, is dangerous).





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>