English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2000-11-03 (17:06)
From: Pierpaolo BERNARDI <bernardp@c...>
Subject: Re: Redefinition doesn't work

On Fri, 3 Nov 2000, Pierre Weis wrote:

> > 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 does bother Lisp users, and they solve the problem (partially) in
different ways.

For example, in Common Lisp it is forbidden to redefine system functions.
In Scheme, you can define functions with the same name of a system one,
but this redefinition cannot change the behaviour of other system

> Scheme has lexical scoping <EM>locally</EM>. It has dynamic binding
> globally, just to address this redefinition problem (as far as I can
> imagine a clever justification to this extremely strange behaviour). I
> remember my surprise when I was porting to Scheme some fancy
> metacompilation stuff written in Caml: unfortunately the Caml code
> ended by redefining (globally) the functions load and compile; how
> strange errors messages when the internals of the Scheme compiler
> tried to use those functions in place of its original versions! I
> needed a long time to figure out what was happening, since I did not
> use directly any Scheme function named compile: I just tried to
> compile my Scheme files as usual, calling some primitive function
> named compile-file (or so), that unfortunately happened to use a
> global function also named compile.

This is not a property of Scheme, is a bug in the implementation you
were using!