Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] duplicate record labels and modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff <brogoff@s...>
Subject: Re: [Caml-list] duplicate record labels and modules
On Tue, 11 May 2004 briand@aracnet.com wrote:
> That's useful.  I need to read the chapter on language extensions more
> closely.

Also, here's the requisite RTFM (I mean that F in the nicest possible way ;)

	http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#labels_surcharge

>   Ville-Pertti> Alternately, assuming the modules are your own, you
>   Ville-Pertti> can name your record fields so that opening both
>   Ville-Pertti> modules doesn't cause conflicts (e.g. using a short
>   Ville-Pertti> prefix).
>
> That's very kludgy, isn't it ?

IMO, it's inconvenient, and a drawback to the language, but not a kludge, or
even a mistake. I reserve that for the undefined order of evaluation :-).
Oh well, you didn't expect paradise, did you?

> I'm assuming the right way is to use modules, which is what started this
> whole exercise for me.

If you must share field names in the same module, your only alternative is to
use the OO part of Ocaml. That's unfortunate, because I think objects are a bit
heavyweight for things like points and segments in a computational geometry
program. OTOH, Ocaml's object system is quite powerful and principled (and
sometimes complex and unintuitive!) compared to lesser languages like C++
and Java. I often think a class system like CLOS or Dylan's would be more to my
liking, but hard to reconcile with ststic typing and modules.

-- Brian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners