Re: The error 'NIL is an illegal type specifier.', was raised while...
Michael Bohn wrote:
I narrowed things down a little now.
This Macro is causing the error.
Everything is fine if I'm evaluating the defun 'find-tag' BEFORE the
macro, but when I'm evaluating first the macro 'tag-case' and then the
defun find-tag the error signaling is broken.
To make it more strange (for me, I'm a lisp beginner), only evaluation
the macro is ok. Only evaluation both, the macro and defun in the order
described above will cause the error.
I tested the same thing on my Mac in LispWorks 4.4.6 (Personal Edition)
and everything seems to work fine there. The error occurs only in the
Windows version of LispWorks 4.4.6 (Personal Edition).
Macro and Defun:
> ;@testcase
> (defmacro tag-case (tagvar &rest body)
> (let ((keywords (list 'null 'list 'tag 'string 'else)) (casevar nil) (casekey 'illegal) is-keyword)
> (setf (symbol-plist casevar) nil)
> (mapc (lambda (token)
> (setf is-keyword (find token keywords)) ;(setf token 'null)
> (cond (is-keyword (setf casekey is-keyword))
> (T (setf (get casevar casekey) (append (get casevar casekey) (list token))))) ;(setf case 'tag token '(bla))
> ) body)
>
> `(cond ((null ,tagvar) (progn ,@(get casevar 'null)))
> ((listp ,tagvar) (progn ,@(get casevar 'list)))
> ((tag-p ,tagvar) (progn ,@(get casevar 'tag)))
> ((stringp ,tagvar) (progn ,@(get casevar 'string)))
> (T (progn ,@(get casevar 'else)))))
> )
>
>
> ;@testcase
> (defun find-tag (tagstruct id)
> (tag-case tagstruct
> NULL nil
> LIST (or (find-tag (first tagstruct) id) (find-tag (rest tagstruct) id))
> TAG (cond ((eql (tag-id tagstruct) id) tagstruct) ;ein einzelner tag
> (T (find-tag (tag-value tagstruct) id))))
> )
>
> (error "test")