I'm confused about an eval-when in cl-info.lisp with GCL
Subject: I'm confused about an eval-when in cl-info.lisp with GCL
From: James Amundson
Date: Fri, 23 Jul 2004 12:28:31 -0500
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?
Yes, that solves the problem. I thought of that, but for some reason I
didn't try it. I often find eval-when confusing.
> Is nregex sufficiently fast with gcl on a moderately slow PC? nregex
> calls the compiler at runtime, and gcl has one of the slowest
> compilers out there.
>
> When I tested this long ago, Clisp's relative slowness in regex
> matching was compensated for by its very fast compiler. CMUCL ran the
> matcher quite fast, but compiling the regex was rather slow.
> However CMUCL was (just!) fast enough on a 300 MHz sparc that it
> wasn't too annoying. Clisp was essentially instantaneous on that
> same sparc.
Ah. Thanks for reminding me about the speed issue. As I recall, I was
the one pushing for a solution that was fast enough on all lisps. The
current implementation I have would probably be irritatingly slow on a
slow machine. I also have to turn off compilation messages in order to
avoid making a big mess on the screen.
I just tried a simple solution: I #-gcl'd the definition of
string-match. GCL has a built-in version of string-match. I think that's
by far the simplest solution.
> Perhaps nregex should be replaced with cl-ppcre, which is known to run
> very fast with clisp and cmucl. Don't know about gcl. (But not for
> the imminent release, of course.)
I was thinking of that, too. If it's just for the info implementation, I
wouldn't think it would be worth the effort. However, it might be useful
to make regular expressions available at the maxima level. In that case,
I think cl-ppcre would be the way to go.
--Jim
P.S. I'm glad I asked. Your (Ray's) and Richard's comments have lead me
to a simpler and more robust implementation than I had when I started.