[Ecls-list] symbol-macro usage

Marko Kocić marko.kocic at gmail.com
Thu Feb 11 10:42:55 UTC 2010


Actually what I was complaining is that when you load fas file
symbol-macro is unbound.  Loading lisp file is ok. It deosn't have to
do with the load-time-values like in hunchentoot examble.

markko at mst:~$ cat bug.lisp
(define-symbol-macro m "tstst")
(defvar a m)

markko at mst:~$ ecl -norc -compile bug.lisp
;;; Loading #P"/home/markko/lib/ecl-10.2.1/cmp.fas"
;;; Loading #P"/home/markko/lib/ecl-10.2.1/sysfun.lsp"
;;; Compiling bug.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;; Compiling (DEFVAR A ...).
;;; Variable M was undefined. Compiler assumes it is a global.
;;; End of Pass 1.
;;; Emitting code for #:G0.
;;; Note: Invoking external command:
;;;   gcc "-I/home/markko/include/"  -D_GNU_SOURCE
-D_FILE_OFFSET_BITS=64 -g -O2 -fPIC  -D_THREAD_SAFE -Dlinux -O -w -c
"/home/markko/bug.c" -o "/home/markko/bug.o"
;;; Note: Invoking external command:
;;;   gcc -o "/home/markko/bug.fas" -L"/home/markko/lib/"
"/home/markko/bug.o"  "-Wl,--rpath,/home/markko/lib/" -shared    -lecl
 -lgmp -lpthread -ldl  -lm
;;; Finished compiling bug.lisp.
markko at maestro:~$ ecl -norc -load bug.fas
;;; Loading "/home/markko/bug.fas"
An error occurred during initialization:
The variable M is unbound..
markko at mst:~$ ecl -norc -load bug.lisp
;;; Loading "/home/markko/bug.lisp"
ECL (Embeddable Common-Lisp) 10.2.1
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.
Top level in: #<process SI:TOP-LEVEL 0000000001598f60>.
> (quit)




On Wed, Feb 10, 2010 at 9:40 PM, Marko Kocić <marko.kocic at gmail.com> wrote:
>>>>> (define-symbol-macro *supports-threads-p*
>>>>>   #+:lispworks t
>>>>>   #-:lispworks bt:*supports-threads-p*)
>>>>>
>>>>> (defvar *global-session-db-lock*
>>>>>   (load-time-value (and *supports-threads-p* (make-lock
>>>>> "global-session-db-lock")))
>>>>>   "A global lock to prevent two threads from modifying *session-db* at
>>>>> the same time \(or NIL for Lisps which don't have threads).")
>>>>
>>>> Are these two forms in the same file?
>>>>
>>>>   -T.
>>
>>
>> In this case, it's not portable code. The standard does not specify in
>> what order forms in LOAD-TIME-VALUE and toplevel forms are evaluated.
>>
>> That said, I don't see a point in using LOAD-TIME-VALUE in combination
>> with DEFVAR. Just get rid of it.
>
> I agree it doesn't do much sense to use load-time-values, but since I
> noted that all other lisp implementations swallow this I thaught it
> might be the problem with ECL.
>
> Thanks,
> Marko Kocić
>




More information about the ecl-devel mailing list