Subject: [clisp-list] Compiler not obeying use-package?

From: William Webber <[email-masked]>
Date: Tue Sep 11 00:17:03 2001

Hi all!

The FFI examples given in the CLISP implementation notes, Extension-2.3,
will not compile.  One of the problems seems to be (?) that the
compiler does not treat "use-package" properly.  So, for instance,
to take a shortened version of the file sort2.lisp given in the
call-in examples:

  (use-package "FFI")
  (def-call-in lispsort_begin (:arguments (n int))
                              (:return-type nil)
                              (:language :stdc)) 

  $ clisp -c sort2.lisp

   Compiling file /home/william/lisp/clisp-ffi/sort/ssort.lisp ...
   WARNING in function #:TOP-LEVEL-FORM-2 in lines 2..4 :
   LISPSORT_BEGIN is neither declared nor bound,
   it will be treated as if it were declared SPECIAL.
   WARNING in function #:TOP-LEVEL-FORM-2 in lines 2..4 :
   INT is neither declared nor bound,
   it will be treated as if it were declared SPECIAL.
   
   Compilation of file /home/william/lisp/clisp-ffi/sort/ssort.lisp is
   finished.
   The following functions were used but not defined:
    DEF-CALL-IN :ARGUMENTS N :RETURN-TYPE :LANGUAGE
   The following special variables were not defined:
    LISPSORT_BEGIN INT

and sort2.c is not produced.  If we change this to:

  (defpackage "SORT2"
     (:use "FFI" "LISP"))
  (in-package "SORT2")
  (def-call-in lispsort_begin (:arguments (n int))
                              (:return-type nil)
                              (:language :stdc)) 

it compiles fine (there are other problems later on, but one thing at
a time...).  Similarly, we can do:

   (ffi:def-call-in lispsort_begin (:arguments (n ffi:int))
                                   (:return-type nil)
                                   (:language :stdc))

Is this a bug in clisp, or in the implementation notes?  Or am I just
confused?

William

---

From: Sam Steingold <[email-masked]>
Date: Tue Sep 11 05:50:03 2001

> * In message <[email-masked]>
> * On the subject of "[clisp-list] Compiler not obeying use-package?"
> * Sent on Tue, 11 Sep 2001 17:13:24 +1000
> * Honorable William Webber <[email-masked]> writes:
>
> The FFI examples given in the CLISP implementation notes,
> Extension-2.3, will not compile.  One of the problems seems to be (?)
> that the compiler does not treat "use-package" properly.  So, for
> instance, to take a shortened version of the file sort2.lisp given in
> the call-in examples:
> 
>   (use-package "FFI")

make it (eval-when (load compile eval) (use-package "FFI"))
or set custom::*package-tasks-treat-specially* to T

> Is this a bug in clisp, or in the implementation notes?  

the latter - thanks for reporting it.

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself! <http://www.i-charity.com/go/israel>
Read what the Arab leaders say to their people on <http://www.memri.org/>
((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x))))