Subject: [clisp-list] Bug in me or CLisp?

From: Douglas Philips <[email-masked]>
Date: Wed Aug 20 13:27:13 2003

The following code works fine interpreted or compiled,
however, "clisp -C test1" barfs with:
*** - FUNCALL: #.#'EQUAL is not a function name

test1.lisp:

(defvar *a* (list (list #'equal 2 2) (list #'equal 2 3)))

(dolist (a *a*)
         (funcall (car a) (cadr a) (caddr a)))

This was with a CLisp that I built from CVS head a few days ago on 
Jaguar.

When I add these two lines to the top of test1.lisp:
(defun m (a b)
     (equal a b))

and change both #'equal to #'m it runs fine.

make check worked fine after my build. Am I just confused about equal's 
function-ability?

<D\'gou

---

From: Sam Steingold <[email-masked]>
Date: Wed Aug 20 18:05:02 2003

> * In message <[email-masked]>
> * On the subject of "Bug in me or CLisp?"
> * Sent on Wed, 20 Aug 2003 16:16:25 -0400
> * Honorable Douglas Philips <[email-masked]> writes:
>

thanks for the bug report (I introduced it when I made -C report errors
like -c does).
I just fixed it in the CVS.
please try again (note that the changes propagate to the anoncvs with a
24 hour delay, so I append the patch.)

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
The paperless office will become a reality soon after the paperless toilet.

Index: compiler.lisp
===================================================================
RCS file: /cvsroot/clisp/clisp/src/compiler.lisp,v
retrieving revision 1.132
diff -u -w -b -u -b -w -i -B -r1.132 compiler.lisp
--- compiler.lisp	14 Aug 2003 18:04:57 -0000	1.132
+++ compiler.lisp	20 Aug 2003 22:53:46 -0000
@@ -9689,7 +9689,7 @@
         (let ((l (append
                    (make-list (fnode-Keyword-Offset fnode))
                    (fnode-keywords fnode)
-                   (if *compiling-from-file*
+                   (if *fasoutput-stream*
                      (mapcar #'(lambda (value form)
                                  (if form (make-load-time-eval form) value))
                              (fnode-Consts fnode) (fnode-Consts-forms fnode))

---

From: Douglas Philips <[email-masked]>
Date: Thu Aug 21 16:19:02 2003

> 24 hour delay, so I append the patch.)

Got that patch (boy the sourceforge mail forwarding service is SLOW).
Updated my CVS head this afternoon.
Now I have a different problem!

(BTW: How do I add/write a test case so that the bug above will be 
caught if ever accidently reintroduced?)

Ok, the new bug: test2.lisp:
(defun xyzzy ((self notype) x y)
    ; ...
   (cons x y))

Not compiled:
clisp test2

*** - SYSTEM::C-ERROR: symbol SYSTEM::*ERROR-COUNT* has no value

But, with clisp -C test2

ERROR in #:COMPILED-FORM-34 :
Illegal lambda list element (SELF NOTYPE)
ERROR in #:COMPILED-FORM-34 :
Illegal lambda list element (SELF NOTYPE)
ERROR in XYZZY :
Illegal lambda list element (SELF NOTYPE)
There were errors in the following functions:
  #:COMPILED-FORM-34 XYZZY

Ah, i don't think '-C' is ready for prime-time as the default just yet. 
;-)

<D\'gou

---

From: Sam Steingold <[email-masked]>
Date: Fri Aug 22 16:39:01 2003

> * In message <[email-masked]>
> * On the subject of "Re: Re: Bug in me or CLisp?"
> * Sent on Thu, 21 Aug 2003 19:16:16 -0400

I introduced this bug when I made DEFUN call LAMBDA-LIST-TO-SIGNATURE at
macroexpansion time.  This saves LIB file size (10%) and thus REQUIRE
load time.

The appended patch should restore the correct error message.

OTOH, I am no longer sure that the 10% saving in LIB file size was
worth the effort.
(a bigger saving might come from putting an IN-PACKAGE statement in all
FAS and LIB files and not using full package prefixes...)

Bruno?

> There were errors in the following functions:

this is just fine: the error message is quite clear, if many a little
bit redundant.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
You think Oedipus had a problem -- Adam was Eve's mother.

Index: init.lisp
===================================================================
RCS file: /cvsroot/clisp/clisp/src/init.lisp,v
retrieving revision 1.104
diff -u -w -b -u -b -w -i -B -r1.104 init.lisp
--- init.lisp	12 Aug 2003 22:20:48 -0000	1.104
+++ init.lisp	22 Aug 2003 19:21:42 -0000
@@ -1622,6 +1622,8 @@
                                 ,@body-rest))))
             `(LET ()
                (SYSTEM::REMOVE-OLD-DEFINITIONS ,symbolform)
+               (SYSTEM::%PUTD ,symbolform
+                              (FUNCTION ,name (LAMBDA ,@lambdabody)))
                ,@(if ; Is name declared inline?
                   (if (and compiler::*compiling*
                            compiler::*compiling-from-file*)
@@ -1665,8 +1667,6 @@
                    `((SYSTEM::%SET-DOCUMENTATION ,symbolform
                                                  'FUNCTION ',docstring))
                    '())
-               (SYSTEM::%PUTD ,symbolform
-                              (FUNCTION ,name (LAMBDA ,@lambdabody)))
                (EVAL-WHEN (EVAL)
                  (SYSTEM::%PUT ,symbolform 'SYSTEM::DEFINITION
                                (CONS ',form (THE-ENVIRONMENT))))