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: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Redefinition doesn't work
> >>>>> "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.
> 
> 
>         Stefan

Absolutely right. In the same vein we have: the absence of static
type-checking ``never seems to bother Lisp users'', the absence of GC
``never seems to bother C users'', the absence of dynamically
allocated arrays ``never seems to bother Pascal users'', the absence
of pattern matching ``never seems to bother Pascal users''...

So what ? Users of these languages have very often to fight against
the absence of these features. In Caml, we chose to provide them to
the user in a simple and rigorous way.

Conversely, we try to avoid the addition of features that can confuse
the users in some situations (and in my mind the rebinding of
identifiers belongs to this category). To be precise, I implemented
this feature long time ago in Caml: it was named the #relet directive
of the toplevel. It had the type-checking constraints I mentioned. So
it was safe. But it was confusing, since people quickly started to
imagine that it meant : everything that mentioned the old function
should now behave as if the old function were the new one. So they
asked this relet feature to be applied recursively everywhere in their
programs, including partially applied functions or even totally
applied functions such as constants expressed as a call to a rebound
function (something like: I relet fib, but my x, defined as let x =
fib 20, has not changed, it still uses the old value of fib!). We
ended up by saying: if you want to obtain this effect, you just have
to reload the entire program ...

So better start by saying ``if you want to obtain this effect, you
just have to reload the entire program''!

Pierre Weis

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