Mac Chan
2007-05-05 02:26:30 UTC
Hi all,
This happened to me a couple times where I have a form like this
(with-html
(:html
(:body
(str (get-error-messages)))))
Now if there's no error, (get-error-messages) returns NIL, otherwise
it returns a description of the problem.
This function also serve as a predicate for other code.
But (str (get-error-messages)) actually prints a "NIL" to the browser.
Of course I could replace (str (get-error-messages)) with
(let ((messages (get-error-messages))
(when messages (str messages))))
or
(str (or (get-error-messages) ""))
however it's getting rather verbose.
But the real issue is that the string "NIL" really doesn't make sense
in HTML, XML or JSON.
It's only something that a Lisp programmer would understand.
So I'm purposing to change the substitution of
(str form) => (princ form1 s)
to
(str form) => (let ((#:result form1)) (when #:result (princ #:result s)))
Attached is a diff for this change in case you guys agree that this makes sense.
Thanks,
-- Mac
This happened to me a couple times where I have a form like this
(with-html
(:html
(:body
(str (get-error-messages)))))
Now if there's no error, (get-error-messages) returns NIL, otherwise
it returns a description of the problem.
This function also serve as a predicate for other code.
But (str (get-error-messages)) actually prints a "NIL" to the browser.
Of course I could replace (str (get-error-messages)) with
(let ((messages (get-error-messages))
(when messages (str messages))))
or
(str (or (get-error-messages) ""))
however it's getting rather verbose.
But the real issue is that the string "NIL" really doesn't make sense
in HTML, XML or JSON.
It's only something that a Lisp programmer would understand.
So I'm purposing to change the substitution of
(str form) => (princ form1 s)
to
(str form) => (let ((#:result form1)) (when #:result (princ #:result s)))
Attached is a diff for this change in case you guys agree that this makes sense.
Thanks,
-- Mac