I'm confused about an eval-when in cl-info.lisp with GCL



>>>>> "James" == James Amundson <amundson@users.sourceforge.net> writes:

    James> On Fri, 2004-07-23 at 12:00, Raymond Toy wrote:
    >> >>>>> "James" == James Amundson <amundson@users.sourceforge.net> writes:
    >> 
    James> I'm confused about some behavior I see in cl-info.lisp under GCL.
    James> cl-info.lisp contains the following snippet:
    James> ----------------------------------------------------------------
    James> (eval-when (compile eval)
    James> (defmacro while (test &body body)
    James> `(loop while ,test do ,@ body))
    James> #+nil
    James> (defmacro f (op x y)
    James> `(,op (the fixnum ,x) (the fixnum ,y))))
    James> ----------------------------------------------------------------
    >> 
    >> Does changing it to (compile load eval) make a difference?

    James> Yes, that solves the problem. I thought of that, but for some reason I
    James> didn't try it. I often find eval-when confusing.

I don't really understand it either.  I think, however, that this
points to a bug in gcl.  I think (compile eval) means that the macro
is defined when compiling the file, so it should be used everywhere in
the file.  Without the load, that means when the compiled file is
loaded, the macro is not defined.  With the load, the macro is also
defined.  

That's my guess.  I don't understand this area at all.

    James> I just tried a simple solution: I #-gcl'd the definition of
    James> string-match. GCL has a built-in version of string-match. I think that's
    James> by far the simplest solution.

Check the corner cases.  I'm not 100% sure the regexes used in cl-info
have the same syntax and semantics as the ones in gcl's matcher.  I
suspect there are some subtle differences, because I vaguely remember
having to play around with the string regexes cl-info to make it work
with nregex.

    James> I was thinking of that, too. If it's just for the info implementation, I
    James> wouldn't think it would be worth the effort. However, it might be useful

I'd prefer not to do that too, because I don't know Perl regexes.  If
someone else wants to try it, and the result is fast, that would be
cool. :-)  The current cl-info is a bit slow with cmucl on my sparc at
work.

Ray