Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Mattias Waldau <mattias.waldau@a...>
Subject: Re: [Caml-list] How to refactor a large Ocaml program
Hi Jacques,

Thank you for the tip.

I think we are talking about different things. Since there is no 
refactoring I will have to settle for something simpler.

A nice thing would be to be able to navigate the program, i.e.

1. Goto to definition (Ctrl-B in Visual Studio)

2. Find usage. (Alt-F7 in Resharper)

A enhanced .annot file as described below would enable that for compiled 
programs. (Resharper and similar tools makes it work for non-compilable 
programs.)

-- Mattias

Jacques Garrigue wrote:
> From: Mattias Waldau <mattias.waldau@abc.se>
> 
>> One problem with ocaml syntax is the open-statement, i.e. this makes it 
>> unclear for an editor
>>
>> Ocaml already has the -dtypes. Why doesn't this file contain information 
>> about where the functions and types are defined.
>>
>> For example, if you have a function call
>>
>> open Filename;
>>
>> let _ =
>> 	concat .........
>>
>> in main.ml
>>
>> the main.annot contains
>>
>> "main.ml" 183 7050 7070 "main.ml" 183 7050 7085
>> type(
>>    string -> string -> string
>> )
>>
>> An improvement would be if it also contained information about the 
>> function, i.e.
>>
>> "main.ml" 183 7050 7070 "main.ml" 183 7050 7085
>> type(
>>    Filename.concat: string -> string -> string
>> )
>>
>> Then, the editor mode 'M-x goto-tag' or similar could look in the .annot 
>> file and open the correct file and go to the definition. (Maybe more 
>> information than Filename.concat is needed).
> 
> FYI, ocamlbrowser can already do that: open your file, typecheck it,
> double-click on an identifier, and use the "impl" button in the type
> browser.
> It would not be much more difficult to do it in emacs, I suppose.
> 
>    Jacques Garrigue
>