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

Vladimir Sedach vsedach at gmail.com
Sun Jul 29 18:50:38 UTC 2012


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 at 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 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
>
> _______________________________________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel




More information about the parenscript-devel mailing list