From emailmac at gmail.com Sat May 5 02:26:30 2007 From: emailmac at gmail.com (Mac Chan) Date: Fri, 4 May 2007 19:26:30 -0700 Subject: [cl-who-devel] semantic for (str NIL) and (esc NIL) Message-ID: <4877ae640705041926x58627dfbp4ac3cc7dcc90ee08@mail.gmail.com> 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 -------------- next part -------------- diff -r -u cl-who-0.8.1/doc/index.html cl-who-0.8.1patch/doc/index.html --- cl-who-0.8.1/doc/index.html 2007-04-27 12:09:30.000000000 -0700 +++ cl-who-0.8.1patch/doc/index.html 2007-05-04 18:51:00.000000000 -0700 @@ -400,14 +400,20 @@
  • A form which is neither a string nor a keyword nor a list beginning with a keyword will be left as is except for the following substitutions: