English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
RE: [Caml-list] Some Clarifications
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-07-27 (18:43)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Some Clarifications
On Wed, 2005-07-27 at 04:55 -0700, Robert Roessler wrote:
> Jon Harrop wrote:

> > In my code, I have used an object once, in order to circumvent a typing 
> > problem. I have never successfully used OO in OCaml.

I have, and they worked quite well -- I was implementing
Python in Ocaml .. the utility of Ocaml objects to represent
Python objects is obvious :)

> An object certainly seems a natural and concise way to represent a 
> "state-holder-with-structured-access" - and I have done just that in a 
> small OCaml project... but that could be the Smalltalk and C++ in my 
> background talking. :)

Generally (whatever that means) one will prefer functional
techniques in Ocaml: not because they're better supported
than Objects, but because transparency and persistence
just make programming easier. However many applications
have to implement protocols that require state to
represent context, and others have to interface with
foreign Object Oriented code (eg Gtk).

In fact the big pain here is that Ocaml is strict about
typing, and if you're modelling a system that isn't,
it can be hard, simply because what you are required
to implement is already flawed.

John Skaller <skaller at users dot sourceforge dot net>