Did anybody manage to get the current version of typerex (1.0.1 I guess) meant for ocaml < 4.0.0 fully working? I currently work with ocaml 3.12.1, which should be good, and emacs24. I followed the instructions on the site of typerex, so I downloaded the gz, did a configure, make, make install and added the emacs lines to my .emacs file. If I launch emacs it performs code highlighting but when I try something from the typerex dropdown menu, like for example rename, I get a 'Command failed : No cmt(i) file for ...'.
According to the site of typerex (http://www.typerex.org/manual-index.html) I should add a line to myocamlbuild file,
Options.ocamlc := S [ A "ocp-ocamlc"]
, which I did like so :
let _ = dispatch & function
| Before_options ->
(* Set up to use ocamlfind *)
Options.ocamlc := S [ A "ocp-ocamlc"]
but still I get the same problem.
My .typerex file points to my _build as mentioned, so CMT _build (that's the only thing present in that file for now).
I'm starting to wonder because apparently cmt files are only supported as of ocaml 4.0.0 or something like that (read that somewhere), so have I got a wrong version of something somewhere (I don't think so, but that doesn't prove anything of course). The documentation on the site is kind of sparse and the support tab immediately forwards to stackoverflow, so here I am, I guess...
Kasper
.cmt
files are produced by OCaml starting at version 4.00. I believe early versions of Typerex provided a specially-modified version of the OCaml compiler that integrated the-bin-annot
branch, already before the 4.00 release ---bin-annot
was precisely developped at OCamlPro for the needs of Typerex.The reason Typerex 2 will be significantly different is that the previous/present design of Typerex makes it too heavy to deploy and, as you can see, difficult to configure. While you wait for a more polished second version, you can use the following very good tools :
Merlin is a young program that incrementally extracts syntax and typing information from OCaml buffers being edited (therefore only partially correct sources), in order to provide early error feedback, type-aware completion, etc. It provides editor modes for Vim and Emacs (the Vim one being more polished now), and I believe it is the right answer to the problem of getting incremental information on partially-complete sources -- it will do better than Typerex for that.
ocamlspot is a program analyzing complete OCaml source files and providing semantic information, currently mostly point-of-definition information. Since 4.00 it relies on the
-bin-annot
machinery and is therefore quite easy to install and deploy (it previously had much of the same problems as pre-4.00 Typerex). It is also usable from Emacs and Vim (but this time the Emacs interface seems more polished).The combination of those tools will not provide you with all the features of Typerex, present or promised (in particular there is not much for refactoring), but they rest on a solid design and will probably evolve nicely as time goes on.