Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
How to refactor a large Ocaml program
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-12-13 (14:42)
From: Mattias_Engdegård <mattias@v...>
Subject: Re: [Caml-list] How to refactor a large Ocaml program
>I don't think it would be a huge effort to write refactoring tools for OCaml. 
>Indeed, I've propose this idea for F#. The hard part is writing the lexer and 
>parser, which is already found in the front end of the compiler (albeit 
>without parsing of comments). Then you're just rewriting an AST, which is a 
>piece of cake in ML. :-)

Writing smooth refactoring tools isn't always that simple, as it's not
just a question of parsing and emitting trees. It is very desirable to
preserve existing layout as far as possible, including comments.
This doesn't mean it's hard, just that it may not be as trivial as an
innocent programmer might think from your comment.

See the Refactoring Functional Programs project, especially its final
report. It was done for Haskell but anyone aspiring to write an OCaml
refactoring tool would do well to learn from it.

Intimately related to refactoring tools are programming environments
with knowledge of the language - for code completion, type information,
source navigation and so on. Tuareg-mode is very nice, but limited.