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
Recursive subtyping issue
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-03-01 (20:18)
From: David Allsopp <dra-news@m...>
Subject: RE: [Caml-list] Recursive subtyping issue
Guillaume Yziquel wrote:
> David Allsopp a écrit :
> >
> > external foo_of_bar : bar -> foo = "%identity"
> >
> > in *both* the .ml and .mli file for the module in question. I'm
> virtually certain that ocamlopt eliminates calls to the %identity
> primitive.
> yziquel@seldon:~$ grep magic /usr/lib/ocaml/obj.mli external magic : 'a
> -> 'b = "%identity"
> So far so good.

I don't follow...?


> > This is tremendously clean - as long as the types are clearly
> documented! The problem is that ocamldoc doesn't let you "document"
> coercions (by which I mean that having a conversion function provides
> means for the documentation of that particular usage).
> Thank you. The ocamldoc problem isn't really a problem, I believe. You
> just have to write it cleanly in bold letters.
> What is more a problem is the fact that inferred .mli files tend to
> leave out the contravariance on tau:
> 	http://caml.inria.fr/mantis/view.php?id=4988
> And hence drops part of the subtyping facility.

Though that's another good reason for never, ever, ever, ever using inferred .mli files - the signature is part of your code! ocamlc -i is useful only for generating the first cut of the file so that you can double-check (and probably constrain) the inferred type annotations and add ocamldoc comments...