[parenscript-devel] :join isn't being interpreted as a javascript function

Russell Sim russell.sim at gmail.com
Mon May 28 23:15:04 UTC 2012


Hi,

I think I have encountered a bug while using the who-ps-html macro.

(who-ps-html
  (:li
    (:img :src icon :size 40)
    (:p message)
    (:span :class "author" name)
    (:span :class "date" timestamp)))

The first expansion of the who-ps-html yields,

(STRINGIFY "<LI><IMG SRC=\"" ICON "\" SIZE=\"40\"><P>" MESSAGE
           "</P><SPAN CLASS=\"author\">" NAME "</SPAN><SPAN CLASS=\"date\">"
           TIMESTAMP "</SPAN></LI>")

But the javascript generated is,

['<LI><IMG SRC="', icon, '" SIZE="40"><P>', message, '</P><SPAN
CLASS="author">', name, '</SPAN><SPAN CLASS="date">', timestamp,
'</SPAN></LI>']['join']('')

I have been able to get the correct behaviour by applying the following
patch, since join is a symbol that is imported via the ps-js-symbols
package.

commit 86d39309692987644798148e24fd67b70667eaa7 (HEAD, refs/heads/master)
Author: Russell Sim <russell.sim at gmail.com>
Date:   Tue May 29 09:12:30 2012 +1000

    Fixed :join bug in stringify expansion.

	Modified   src/non-cl.lisp
diff --git a/src/non-cl.lisp b/src/non-cl.lisp
index 387bd29..f2ed0e7 100644
--- a/src/non-cl.lisp
+++ b/src/non-cl.lisp
@@ -203,7 +203,7 @@
 (defpsmacro stringify (&rest things)
   (if (and (= (length things) 1) (stringp (car things)))
       (car things)
-      `((@ (list , at things) :join) "")))
+      `((@ (list , at things) join) "")))
 (defun stringify (&rest things)
   "Like concatenate but prints all of its arguments."
   (format nil "~{~A~}" things))

Cheers,
Russell




More information about the parenscript-devel mailing list