[cl-who-devel] semantic for (str NIL) and (esc NIL)

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

"Mac Chan" <emailmac@gmail.com> writes:
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.
Yes, therefore, IMHO, it's important for a programmer for debugging purposes. I'm not against the change, but if it would be done, it should better be controlled by a (yet another annoying) switch. Regards.

On Fri, 4 May 2007 19:26:30 -0700, "Mac Chan" <emailmac@gmail.com> wrote:
Attached is a diff for this change in case you guys agree that this makes sense.
Yes, I think it makes sense. I've made a new release with your patch incorporated. Others, please note that this isn't fully backwards-compatible although I doubt that serious applications so far relied on the fact that (STR nil) would produce "NIL" in the output. Thanks, Edi.

My only complaint about this, which is a minor one, is that when I see NIL in my HTML, it's a good sign that I've screwed something up. Now I won't have that anymore, but that's ok I guess. Cyrus On May 8, 2007, at 2:34 PM, Edi Weitz wrote:
On Fri, 4 May 2007 19:26:30 -0700, "Mac Chan" <emailmac@gmail.com> wrote:
Attached is a diff for this change in case you guys agree that this makes sense.
Yes, I think it makes sense. I've made a new release with your patch incorporated.
Others, please note that this isn't fully backwards-compatible although I doubt that serious applications so far relied on the fact that (STR nil) would produce "NIL" in the output.
Thanks, Edi. _______________________________________________ cl-who-devel site list cl-who-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/cl-who-devel
participants (4)
-
Cyrus Harmon
-
Edi Weitz
-
Mac Chan
-
Volkan YAZICI