From: Erik H. <eh...@gm...> - 2009-04-03 19:44:06
|
Since I'm answering myself anyways, I might as well top post: The fix was much easier than the bits mentioned below: restart-case is a macro macro-expanding subforms, which means it should itself take an environment parameter and use that when expanding the subforms. RESTART-CASE didn't do that. Now it does :-) This takes us to only 43 failures in the ansi test suite (interpreted mode) on my system. Bye, Erik. On Fri, Apr 3, 2009 at 9:16 AM, Erik Huelsmann <eh...@gm...> wrote: > On Thu, Apr 2, 2009 at 11:54 PM, Erik Huelsmann <eh...@gm...> wrote: >> Ok. After studying both our code (using TRACE) and the CLHS, I found >> the issue with the 3 RESTART-CASE failures. Unfortunately, the cause >> is not what I had hoped for (which is that we found issues with more >> special variable bindings) but it's not. The good thing however, is >> that the failure is really related only to macroexpansion. >> >> This is what happens: >> >> MACROEXPAND doesn't expand subforms established by MACROLET >> >> When expanding RESTART-CASE, the macro inspects the first atom in the >> restart form, in order to see if the restart needs to be associated >> with some condition or another. It establishes that by looking for the >> ERROR, CERROR, SIGNAL or WARN symbols (it may use others; see CLHS >> RESTART-CASE). > > The passage I'm referring to is (in RESTART-CASE definition): > > " > If the restartable-form is a list whose car is any of the symbols > signal, error, cerror, or warn (or is a macro form which macroexpands > into such a list), then with-condition-restarts is used implicitly to > associate the indicated restarts with the condition to be signaled. > " > >> When RESTART-CASE looks at the form in casu, it's finding %m or %s >> instead of (ERROR ...) to which the %m and %s expand. >> >> It looks our interpreted MACROEXPAND needs to be a bit smarter... > > I've been thinking about this; our precompiler does macro-expansion. > How about using the precompiler to expand the forms? For example by > renaming the built-in MACROEXPAND -> %MACROEXPAND. Then, in boot.lisp > one of the first things to do is to define MACROEXPAND as follows: > > (defun macroexpand (&rest args) > (apply #'%macroexpand args)) > > Which would get redefined in precompile.lisp as (something like): > > (defun macroexpand (form &optional environment) > (let ((*compile-file-environment* environment)) > (precompile-form form))) > > > Then, after the precompiler gets loaded, full macro expansion becomes > available as per the requirements of the test. > > > Comments? > > > Bye, > > Erik. > |