Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Redefinition doesn't work
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ruchira Datta <datta@m...>
Subject: Re: Redefinition doesn't work
Pierre Weis wrote:
>Mattias Waldau wrote:
>> One of the reason of me liking OCaml is the interactive top level. However,
>> it is a bit messy always remember to redefine all functions that depend of
>> the function you just corrected.
>
>You just have to use a very simple rule: reload your source file after
>each correction (use #use "filename.ml";;).

Well, part of the point of the interactive top level is that you can try
out commands at the prompt, rather than having to put them in a separate
file.  However, you can have the best of both worlds with ledit
(see http://cristal.inria.fr/~ddr).  Just keep a running history of
your interactive session by starting it up as follows:

ledit -h "./ocaml_history" -x ocaml

Then to reload the functions that depend on the function you just corrected,
you have two options (which is more convenient depends on how many 
redefinitions have to be made): 

- if there are only a few redefinitions:
  just use the up arrow to go back to the original definitions and
  reenter them

- if there are many redefinitions:
  go into a text editor in a separate window, paste their definitions from 
  the file ocaml_history into some other file, e.g., temp.ml, and finally 
  go back to your ocaml interactive session and load the file with 
  #use "temp.ml" as above.

Ruchira Datta
datta@math.berkeley.edu