Version française
Home     About     Download     Resources     Contact us    
Browse thread
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: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Redefinition doesn't work
> 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";;).

> 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.

Yes, as you know this is static binding.

> 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.

So what the point with the memory and the processor ?

> What is the reason for this misfeature?

This is not a misfeature, but an extremely desirable property: a sound
theoretical fundation for the binding rule of identifiers in the
language. This rule means that every identifier in a program is bound
before the point of use. This is simple to explain and clear to
understand. Furthermore it allows the static verification of type
correctness.

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/