[parenscript-devel] Loops that return a value

Daniel Gackle danielgackle at gmail.com
Thu Jan 17 16:52:58 UTC 2013


I think it's significant, though admittedly minor, because readable
JS is one of the goals of the project.

Speaking of readable JS, by far the biggest problem I encounter
is when PS bundles a complex expression into comma-delimited
Javascript like "(foo(),bar(),baz())" which is basically a progn
that evaluates to baz(). These things often create monstrous
one-liners. I don't have a good idea of what to do about it --
I recall that Vladimir tried to pretty-print them at one point
and this turned out harder than it seemed -- but it's definitely
the #1 thing that would prevent me from trying to persuade
a JS programmer that my compiled PS is readable.


On Thu, Jan 17, 2013 at 9:44 AM, Boris Smilga <boris.smilga at gmail.com>wrote:

> Also, there is this baddie:
>
>
> On 16 Jan 2013, at 00:18, David Sargeant wrote:
>
>  (function () {
>>     var collect66 = [];
>>     for (var num = 10; num <= 1; num += 1) {
>>         collect66['push'](num);
>>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>>     };
>>     return collect66;
>> })();
>>
>
> Not at all a major issue, but collect66.push would fit rather better in
> this context.  There are a couple more instances of this kind in the code
> of ParenScript, they all boil down to keywords being used with @ instead of
> literal symbols:
>
> src/lib/ps-dom.lisp:6:  `(@ ,el :inner-h-t-m-l))
> src/lib/ps-dom.lisp:12:  `((@ ,el :get-attribute) ,attr))
> src/lib/ps-loop.lisp:102:         (then (if (numberp by) `((@ ,var :slice)
> ,by) `(,by ,var))))
> src/lib/ps-loop.lisp:167:        (:collect `((@ ,var :push) ,item))
> src/macros.lisp:177:                     (if (eql ,funobj (@ __PS_MV_REG
> :tag))
> src/macros.lisp:178:                         (@ __PS_MV_REG :values)
> src/non-cl.lisp:189:      `((@ (list , at things) :join) "")))
>
> Do you think we should fix them, or is this totally insignificant?
>
>  — B. Smilga.
>
>
>
> ______________________________**_________________
> parenscript-devel mailing list
> parenscript-devel at common-lisp.**net <parenscript-devel at common-lisp.net>
> http://lists.common-lisp.net/**cgi-bin/mailman/listinfo/**
> parenscript-devel<http://lists.common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20130117/fbb0f8fa/attachment.html>


More information about the parenscript-devel mailing list