Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!mcsun!ukc!edcastle!aiai!jeff From: jeff@aiai.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: DEFVAR is forever Message-ID: <1725@skye.ed.ac.uk> Date: 10 Feb 90 17:23:30 GMT References: <3277@accuvax.nwu.edu> <1990Jan28.175437.19293@hellgate.utah.edu> <1990Jan29.224305.20803@hellgate.utah.edu> <385@forsight.Jpl.Nasa.Gov> <1652@skye.ed.ac.uk> Reply-To: jeff@aiai.UUCP (Jeff Dalton) Organization: AIAI, University of Edinburgh, Scotland Lines: 36 In article alms@cambridge.apple.com (Andrew L. M. Shalit) writes: >In article <1652@skye.ed.ac.uk> jeff@aiai.ed.ac.uk (Jeff Dalton) writes: > However, nothing says an implementation can't provide some way to > turn off a SPECIAL proclamation (which is how DEFVAR makes the > variable special). There just isn't a standard way to do it. >Turning off a special proclamation would involve going through all the >compiled functions in the world which reference the variable, and >changing them to treat the variable as lexical. I'd call that "undoing the effects of the DEFVAR". In any case, I didn't intend it to be a necessary part of "turn off". The variable could be made nonspecial [ie, no longer proclaimed special] without undoing all the effects of it having once been special. A fairly similar case would be that of redefining a macro as a function. Many implementations let you do that but don't try to make the world be as if the macro had never been defined. >Some implementations might be able to backpatch the functions, but >others would probably need to recompile them. Here too it's useful to think of the macro case. A number of implementations re-expand macro calls each time they're evaluated by the interpreter. (Or they cache expansions and re-expand only if the macro has been redefined.) Likewise, they re-determine whether or not a variable is special each time the interpreter evaluates a binding form. So most of the effects are undone, in effect, just by the way the interpreter works. It's only when we turn to compiled code that things like backpatching and recompilation become necessary. Most implementations (as far as I know) don't automatically undo the effects of canceled special proclamations, or of macros redefined as function, in compiled code. -- Jeff