caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: Redefinition doesn't work
@ 2000-11-02 22:45 Ruchira Datta
  2000-11-03  9:13 ` Pierre Weis
  0 siblings, 1 reply; 36+ messages in thread
From: Ruchira Datta @ 2000-11-02 22:45 UTC (permalink / raw)
  To: caml-list

Stefan Monnier wrote:
>>>>>> "Pierre" == Pierre Weis <Pierre.Weis@inria.fr> writes:
>> It is not only a question of type. As I mentioned in my previous
>> message, if you allow the user to ``rebind'' some basic functions,
>> such as map or iter, the behaviour of the compiler can be
>> unpredictable.
>
>It never seems to bother Lisp users.

It must have bothered some Lisp users, otherwise why does Scheme have
lexical scoping?

Ruchira Datta
datta@math.berkeley.edu



^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: Redefinition doesn't work
@ 2000-10-31 19:11 Ruchira Datta
  2000-11-02 18:05 ` Trevor Jim
  0 siblings, 1 reply; 36+ messages in thread
From: Ruchira Datta @ 2000-10-31 19:11 UTC (permalink / raw)
  To: caml-list

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



^ permalink raw reply	[flat|nested] 36+ messages in thread
* Redefinition doesn't work
@ 2000-10-28  7:32 Mattias Waldau
  2000-10-28 16:37 ` Pierre Weis
  0 siblings, 1 reply; 36+ messages in thread
From: Mattias Waldau @ 2000-10-28  7:32 UTC (permalink / raw)
  To: Caml-List

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.

For example below, f2 doesn't notice the redefinition of f1, even if the
types of the new and old definition of f1 are the same.

The last language I used that had this feature was Forth, and that was 20
years ago, we used 8Kb of memory and a 6502. These 8 Kb contained both the
interactive compiler, the program, and the data.

What is the reason for this misfeature?


# let f1 () = 10;;
  val f1 : unit -> int = <fun>
# let f2 () = (f1 ()) * 10;;
val f2 : unit -> int = <fun>
# f2 ();;
- : int = 100
# let f1 () = 20;;
val f1 : unit -> int = <fun>
# f2 ();;
- : int = 100
#

----
Mattias Waldau




^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2000-11-13  8:17 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200010300739.IAA13016@pauillac.inria.fr>
2000-10-30 23:38 ` Redefinition doesn't work Jaeyoun Chung
2000-10-31 11:06   ` Pierre Weis
2000-10-31 11:52     ` Sven LUTHER
2000-10-31 16:47       ` Pierre Weis
2000-10-31 18:55         ` Stefan Monnier
2000-11-02 15:42           ` Pierre Weis
2000-11-03  3:10             ` Stefan Monnier
2000-11-03  8:44             ` Good programming languages (Was: Redefinition doesn't work) Mattias Waldau
2000-11-03 15:27               ` bcpierce
2000-11-06  0:17                 ` Jacques Garrigue
2000-11-08 18:42                 ` Markus Mottl
2000-11-09 16:20                   ` Juan J. Quintela
2000-11-10 10:06                     ` Markus Mottl
2000-11-13  7:48                       ` Stephan Houben
2000-11-10 19:06                     ` Remi VANICAT
2000-11-06  6:17               ` Francisco Reyes
2000-11-07 17:36                 ` Brian Rogoff
2000-10-31 14:16     ` Redefinition doesn't work Frank Atanassow
2000-10-31 17:07       ` Pierre Weis
2000-10-31 17:26         ` LINUX MANDRAKE -> CAMLTK? mlf
2000-11-02 20:21           ` Pierre Weis
2000-11-02 22:45 Redefinition doesn't work Ruchira Datta
2000-11-03  9:13 ` Pierre Weis
2000-11-03 10:09   ` Michael Sperber [Mr. Preprocessor]
2000-11-03 16:56     ` Pierre Weis
2000-11-03 17:36       ` Michel Mauny
2000-11-05 11:15       ` Michael Sperber [Mr. Preprocessor]
2000-11-06 21:30         ` Bruce Hoult
2000-11-03 16:58   ` Pierpaolo BERNARDI
2000-11-06  9:29     ` Stephan Houben
2000-11-03 17:30   ` Stefan Monnier
2000-11-05 11:16     ` Michael Sperber [Mr. Preprocessor]
  -- strict thread matches above, loose matches on Subject: below --
2000-10-31 19:11 Ruchira Datta
2000-11-02 18:05 ` Trevor Jim
2000-10-28  7:32 Mattias Waldau
2000-10-28 16:37 ` Pierre Weis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).