Clos Warnings in Corman
Karsten <[email protected]>
| Newsgroups | gmane.lisp.corman |
|---|---|
| Message-ID | <[email protected]> |
Hello,
regarding the bunch of warnings Corman generates in typical CLOS methods like
(defmethod nada ((x string))
23)
I wrote a patch to avoid the warnings (and submitted the code to roger).
I don't know about performance implications, but using the code it is
easier to find the real warnings.
I have a bunch a other patches that I submitted to Roger and that might
appear in the next release.
I am a bit unsure about how to handle such patches. To people publish them
in some place before they are incoporated in the main source stream? On one
hand I like to avoid fall into a trap that other's already have discovered
on the other hand I don't like to create to much entropy in the development.
Karsten
PS: Code follows
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/FpY02D/vN2EAA/xGHJAA/SyjtlB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
clos-args.lisp
(text/plain, 1.9 KB)
(in-package :common-lisp)
;;;; Fix the warning about unused variables used as specialisers
(defun extract-variables-for-dispatching (specialized-lambda-list)
(let ((plist (analyze-lambda-list specialized-lambda-list)))
(getf plist ':required-names)))
(defun parse-defmethod (args)
(let ((fn-spec (car args))
(qualifiers ())
(specialized-lambda-list nil)
(body '())
(decls '())
(doc-string nil)
(parse-state :qualifiers))
(do* ((a (cdr args))
(arg (car a)(car a)))
((null a))
(cond
((eq parse-state :qualifiers)
(if (and (atom arg) (not (null arg)))
(progn
(push-on-end arg qualifiers)
(setf a (cdr a)))
(setq parse-state :lambda-list)))
((eq parse-state :lambda-list)
(setq specialized-lambda-list arg)
(setq parse-state :decls)
(setf a (cdr a)))
((eq parse-state :decls)
(if (and (consp arg)(eq (car arg) 'declare))
(progn
(push-on-end arg decls)
(setf a (cdr a)))
(setq parse-state :doc-string)))
((eq parse-state :doc-string)
(when (stringp arg)
(setq doc-string arg)
(setf a (cdr a)))
(setq parse-state :body))
((eq parse-state :body)
(push-on-end arg body)
(setf a (cdr a)))))
;; watch for case where a literal string is the only item in body--
;; we don't want to mistake it for a doc-string
(if (and (null body) doc-string)
(setf body (list doc-string) doc-string nil))
(values fn-spec
qualifiers
(extract-lambda-list specialized-lambda-list)
(extract-specializers specialized-lambda-list)
`(,@decls
,@(if doc-string (list doc-string))
(block
,(if (consp fn-spec) (cadr fn-spec) fn-spec)
;;;;; KAP don't want warnings about unused variables
,@(extract-variables-for-dispatching specialized-lambda-list)
,@body)))))