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
annotate a .ml file with type information
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-11-19 (14:32)
From: Thomas Gazagnaire <ocaml@g...>
Subject: annotate a .ml file with type information
Hi all,

I would like to write a camlp4 extension which use infered-type information.
To do that, I can see two ways:
* either calling an type-inference function of the compiler, giving it an
AST and a context associating identifiers to types which seems to me a bit
complicated (and maybe impossible),
* or annotating the original source code with infered-type information -
which seems to me simpler. In this case, I believe that it is not difficult
to merge an ml file and its corresponding .annot file to produce a file
where every identifier is type annotated, but it seems to me a bit overkill
to do it at this stage as it would be simpler to do it directly after the
type-inference phase of the compilation. So, patching the compiler to make
it producing such a file with a special option (as -infertypes) seems also
good to me.

I would like to ask people what they are thinking of this problem and before
starting to work on it, I wondering if someone is aware or either an
existing ml-annot merger or a hidden compiler flag to produce such a file ?
Or if there is a reason why it should be not possible to do so :-)