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

Edi Weitz edi at agharta.de
Fri Mar 30 07:52:05 UTC 2007


On Thu, 29 Mar 2007 11:14:04 -0700, "Mac Chan" <emailmac at gmail.com> wrote:

> 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.

I don't remember the details, but I guess this was just an oversight
of Stefan when he sent the HTML-MODE patch in 2005.  Feel free to send
a patch to change this behaviour if you think it's worth it.

Thanks,
Edi.



More information about the Cl-who-devel mailing list