(ps (create a 11 b 22)) => "{ a : 11, b : 22 };", which is illegal at the top level because JS interprets the curly braces as statement block delimiters. PS should probably generate "({ a : 11, b : 22 })" instead.
Similarly, (ps (lambda () 123)) =>
"function () { return 123; };"
is also illegal at the top level and should also be wrapped in parens.
Such forms obviously don't come up much in source files, but they do in a REPL. We're making a PS REPL (and source-level debugger) for Emacs, which is how we ran across them.
I've pushed a patch that fixes both the object literal and top-level lambda printing. Let me know if you see anything else broken.
Vladimir
On Mon, Nov 7, 2011 at 5:15 PM, Daniel Gackle danielgackle@gmail.com wrote:
(ps (create a 11 b 22)) => "{ a : 11, b : 22 };", which is illegal at the top level because JS interprets the curly braces as statement block delimiters. PS should probably generate "({ a : 11, b : 22 })" instead.
Similarly, (ps (lambda () 123)) =>
"function () { return 123; };"
is also illegal at the top level and should also be wrapped in parens.
Such forms obviously don't come up much in source files, but they do in a REPL. We're making a PS REPL (and source-level debugger) for Emacs, which is how we ran across them.
parenscript-devel mailing list parenscript-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel@common-lisp.net