[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Date: Thu 5 Nov 87 00:01:23-PST
From: "Kim A. Barrett" <IIM@ecla.usc.edu>
It is our opinion that it is reasonable for a local function/macro to be
able to shadow a special form. If such shadowing is not allowed, it's
basically just another totally arbitrary rule that the programmer has to
remember. It also makes for some extra work for program-analyzing
programs, either in the analysis of flet/labels/macrolet forms, where it
must check the names to see if they would shadow any of the standard
special-forms, or at form-processing time (where it is currently impossible
to do portably).
I, just to be different, do not think that it is reasonable or desirable to
hide special-forms lexically. These forms really are special, users have to understand
them separately from other things like funtion call. Making it so that
could be lexically hidden only makes special forms superficially like other forms.
You still cant funcall a special form.
It seems to me that the necessary functionality for examining the
function environment is pretty easy to describe. All you really need is
(defun local-function-p (symbol environment)
"This function returns T if the specified symbol names a local
function or macro in the specified environment, and Nil otherwise.
Environment should be either the environment argument passed to a
macroexpander function (obtained with the &environment
lambda-keyword), or the environment argument to applyhook/evalhook."
I have had this problem as well. One of the few places where I've *HAD* to resort
to #+symbolics ..., #+lucid ... I would suggest that it return something different
so that lexical macros can be distinguished from lexical functions.
Say return multiple values where the first value is t if is a local function or
macro and the second value of t if the symbol is lexical macro.
I would expect that, for any given implementation, it is completely
trivial to write the code for local-function-p. Does anyone know of a
counter-example? With this function available, when your code walker is
processing a form which is a list whose car is a symbol, it does the
The functionality needed for augmenting environments is less obvious to
me, since I haven't studied all that many code walkers to know what their
needs are, nor all that many implementations, to know what their quirks
are, as far as manipulation of environments is concerned. I think
something like the following would be adequate for the walkers and
implementations I have seen, but feel free to blow holes in it.
I am not really convinced that this is needed. But, I havent really thought about it.