Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Re: OCAML Downcasting?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Re: OCAML Downcasting?
On Wed, Sep 22, 2004 at 08:31:38AM +0200, Marcin 'Qrczak' Kowalczyk wrote:
> skaller <skaller@users.sourceforge.net> writes:
> 
> >> Attempts to avoid downcasts are often unmodular, they require to
> >> specify all possible variants in one place.
> >
> > It makes no difference. You have do specify them all anyhow,
> > downcast or not.
> 
> It makes a difference because specifying them at the type definition
> would introduce a dependency loop between modules. And it would be
> unmodular: it would require changing some base module whenever a far
> client module is added.

I've tended to stop using and thinking in OO terms since starting to
use OCaml.  In particular, when I need a data structure of some sort,
I just use a data structure (tuple, struct, variant whatever).  Before
coming to OCaml, data structure implied "class" for me.

The advantage to me is that now when I change the data structure the
compiler catches all the places in the code which I need to change, so
I go through and methodically change them.

But the OCaml assumption here is that you program is one big
monolithic entity, for which you have source (and are recompiling) all
parts.  This goes against the OO theory of "reuse" - particularly of
reuse of binary classes, which I don't think I've ever actually used
in practice anyway.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
NET::FTPSERVER is a full-featured, secure, configurable, database-backed
FTP server written in Perl: http://www.annexia.org/freeware/netftpserver/