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 <weis@p...>
Subject: Re: Redefinition doesn't work
> 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

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.

That's an example of a user that does not want the functions to be
redefined everywhere, since he cannot understand the consequences of
the redefinition since he does not even know where the rebound
function was used!

Pierre Weis

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