[parenscript-devel] :join isn't being interpreted as a javascript function
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@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 ,@things) :join) ""))) + `((@ (list ,@things) join) ""))) (defun stringify (&rest things) "Like concatenate but prints all of its arguments." (format nil "~{~A~}" things)) Cheers, Russell
Russell, Let's wait for Vladimir to double-check this, but I expect he'll apply your patch when he's back. Daniel On Mon, May 28, 2012 at 7:15 PM, Russell Sim <russell.sim@gmail.com> wrote:
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@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 ,@things) :join) ""))) + `((@ (list ,@things) join) ""))) (defun stringify (&rest things) "Like concatenate but prints all of its arguments." (format nil "�窿�翳轭珞┅����描邋蝮��阴篌屐����哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌哌��疳蝈铙泸轲舡溴鲥�磲殪轭�扉篝��疳蝈铙泸轲舡溴鲥炖泔眄镱轶甬铄��梏麴函轶趔镯盹瞽扉箴弭玳轭衢祉犷轶糸铈锆疳蝈铙泸轲舡溴鲥��
Daniel Gackle <danielgackle@gmail.com> writes:
Let's wait for Vladimir to double-check this, but I expect he'll apply your patch when he's back.
That's fine, thanks for the feedback Russell
Hi Russell, Is there any browser on which that code is failing? foo['bar'] is equivalent to foo.bar and so foo['bar'](baz) should be as valid a function call as foo.bar(baz) Thank you, Vladimir On Mon, May 28, 2012 at 7:15 PM, Russell Sim <russell.sim@gmail.com> wrote:
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@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 ,@things) :join) ""))) + `((@ (list ,@things) join) ""))) (defun stringify (&rest things) "Like concatenate but prints all of its arguments." (format nil "~{~A~}" things))
Cheers, Russell
_______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
Vladimir Sedach <vsedach@gmail.com> writes:
Is there any browser on which that code is failing? foo['bar'] is equivalent to foo.bar and so foo['bar'](baz) should be as valid a function call as foo.bar(baz)
No there isn't. I agree, they are equivalent. I guess my eagerness to contribute outweighed my javascript mojo :) Thanks, Russell
participants (3)
-
Daniel Gackle
-
Russell Sim
-
Vladimir Sedach