[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Defun inside Let

I was about to reply to Plummer's objections, but discovered that others
had already said most of what I want to.  I agree with Jonathan Rees and
with Rob Maclachlan on this issue.

It is certainly true that for debugging purposes, there are some useful
things that a Common Lisp environment might supply to make people with
debugging styles like Plummer's more comfortable.  For example, it might
be nice to be able to grab a function's definition and say "I want to
define an additional function in the same lexical environment that
this guy sees" or "I want to redefine this function, but continue using
the lexical environment of the old definition (plus the following
additional lexical variables)".  In most Common Lisp interpreters I have
seen (and all of the ones I've written), it's pretty trivial to add
that, though it does require descending to system-internal levels to do

Nothing in Common Lisp makes this impossible or even very hard.  We
could probably add a standard set of hooks to make such a feature
portable if we tried hard enough, but after all the hassle we went
through to put in the evalhook stuff, I'm not eager to go through that
sort of exercise again.  Let the manufacturers compete to produce the
best debugging environment, each consistent with his machine's style and
philosophy of user interaction.

It is much harder to add such facilities for modifying compiled
functions that share a lexical environment.  The easy way to do this
would be to follow the trail back to the source code, make the changes
the user wants, and then recompile the whole top-level form which
defines the lexical environment in question.  I'm quite content to do
this by hand, but there's no reason that someone couldn't write a
package to do it automatically, much as flavor methods are now
recompiled when you change anything.

-- Scott