Discussion:
*downcase-tags-p* for attributes, setting *downcase-tags-p* for compile-time
Dave Cooper
2007-08-14 05:08:03 UTC
Permalink
Hi,

Has anyone else found it necessary to conditionalize the downcasing of
attribute names, like what is currently done with regular tags? For
example in the following bit of X3D:

(with-html-output (*stream* nil :indent t)
(:Shape
(:Appearance
(:Material :diffuseColor "0 1 0") ... )))

the diffuseColor attribute name needs to have its case preserved.

Second question: the *downcase-tags-p* has to be set to nil at compile
time. This is probably more of a general Lisp question and not so
specific to cl-who, but what is the preferred way of setting a
variable like this to a non-default value for the duration of
compiling a file, similar to what one would do with a special variable
at runtime with

(let ((*downcase-tags-p* nil)) ...)

or

(let (*downcase-tags-p*) ...)

?

I am hoping to find something less error-prone (and thread-unsafe) than this:

;; beginning of the file
(eval-when (compile load eval) (setq *downcase-tags-p* nil))
;;

...

;; end of the file
(eval-when (compile load eval) (setq *downcase-tags-p* t))
;;

Thanks,

-dave

--
Dave Cooper, Head of Product Development, Genworks International
***@genworks.com, dave.genworks.com(skype)
USA: 248-327-3253(o), 1-800-731-9220(toll-free)
UK: +44 (0) 191 645 1699
Edi Weitz
2007-08-24 08:10:25 UTC
Permalink
Post by Dave Cooper
Has anyone else found it necessary to conditionalize the downcasing
of attribute names, like what is currently done with regular tags?
Yes, you're not the only one - see the new 0.11.0 release.
Post by Dave Cooper
Second question: the *downcase-tags-p* has to be set to nil at
compile time.
Yep, this is by design. You can call it a feature in the sense of
optimization, but you can also call it a design flaw as CL-WHO
currently doesn't export functionality to compose output at runtime.
This would require a major overhaul for which I don't have enough time
at the moment.
Post by Dave Cooper
;; beginning of the file
(eval-when (compile load eval) (setq *downcase-tags-p* nil))
;;
...
;; end of the file
(eval-when (compile load eval) (setq *downcase-tags-p* t))
;;
I'm not aware of a better solution. Maybe the ASDF experts have an
idea how this could be done in a more elegant way, but that would be
outside the ANSI standard.

Cheers,
Edi.

Loading...