Discussion:
CL-WHO:STR behavior and package nicknames.
Erik Enge
2006-07-27 20:37:02 UTC
Permalink
(cl-who 0.6.0, linux, sbcl 0.9.13)

Hi!

In the documentation I find the following example:

(:table :border (+ 1 2)) => (write-string "<table border='" s)
(princ (+ 1 2) s)
(write-string "' />" s)

However, in my implementation I see the following:

CL-USER> (cl-who:with-html-output-to-string (*standard-output*)
(:table :border (+ 1 2)))
"<table border='(+ 1 2)' />"

This makes sense because CONSTANTP returns T for that form in SBCL and
NIL in CMUCL. In which case I think I'm supposed to use the STR
operator:

CL-USER> (cl-who:with-html-output-to-string (*standard-output*)
(:table :border (cl-who:str (+ 1 2))))
"<table3 border='3' />"

ESC does pretty much the same thing. So does FMT I guess except it
doesn't print the border attribute since the format call returns nil,
which I think makes sense. Is this the expected behavior? Is there
another way of having (:table :border (+ 1 2)) do what I want (output
<table border='3' />)?

Separately, would you consider adding the nickname "who" (or whatever
you like, just shorter than "cl-who") to the package?

Thanks,
Erik.
Edi Weitz
2006-07-27 21:51:41 UTC
Permalink
Hi Erik!
Post by Erik Enge
(:table :border (+ 1 2)) => (write-string "<table border='" s)
(princ (+ 1 2) s)
(write-string "' />" s)
CL-USER> (cl-who:with-html-output-to-string (*standard-output*)
(:table :border (+ 1 2)))
"<table border='(+ 1 2)' />"
This makes sense because CONSTANTP returns T for that form in SBCL
and NIL in CMUCL.
Right, I didn't think of that. What I actually /meant/ in this case
was that this form should be evaluated and I think because it is
CONSTANTP this is one of the few occasions where usage of EVAL is OK.
Anyway, I've uploaded a new version which does exactly that.
No, STR, ESC, and FMT aren't really meaningful in attribute positions.
They are supposed to occur in the body of a tag.
Post by Erik Enge
Separately, would you consider adding the nickname "who" (or
whatever you like, just shorter than "cl-who") to the package?
Done in 0.6.1.

Thanks for the report,
Edi.

Loading...