[cl-who-devel] should cl-who::*html-mode* be a compile time flag?

Mac Chan emailmac at gmail.com
Thu Mar 29 18:14:04 UTC 2007


Hi,

The following code

(defparameter *checked* nil)

(with-html-output (#:out nil :prologue nil :indent nil)
  (:input :type "checkbox" :checked *checked*))

will get expanded to

=>

(let ((#:out #:out))
  (progn
   nil
   (write-string "<input type=\"checkbox\"" #:out)
   (let ((#:g2546 *checked*))
     (cond ((null #:g2546))
           ((and (eq #:g2546 t) (eq cl-who::*html-mode* :xml))
            (progn (write-string " checked=\"checked\"" #:out)))
           ((and (eq #:g2546 t) (eq cl-who::*html-mode* :sgml))
            (progn (write-string " checked" #:out)))
           (t
            (progn
             (write-string " checked=\"" #:out)
             (princ #:g2546 #:out)
             (write-string "\"" #:out)))))
   (write-string " />" #:out)))


My question is, should the macro generate code based on the value of
*html-mode* at compile/load time instead of runtime?

If there are a lot of attributes the generated code will be bloated
and I can't imagine a situation where you want to apply the same
cl-who syntax tree with different *html-mode* at runtime.

If there's a rational behind this I'd like to learn about it.

Thanks,
-- Mac



More information about the Cl-who-devel mailing list