[parenscript-devel] four patches to PS-LOOP etc.

Vladimir Sedach vsedach at gmail.com
Sat Jul 21 21:01:19 UTC 2012


Hi Boris,

Thank you for the patches, the code makes sense.

I've applied 0001 and 0002. Because patch 0003 causes all LOOPs to be
wrapped in blocks, and loop is used in various places, this means that
this code:

(defun hello-world (&key ((:my-name-key my-name) 1))
    my-name)

Used to look like:

function helloWorld() {
    var _js2 = arguments.length;
    for (var n1 = 0; n1 < _js2; n1 += 2) {
        switch (arguments[n1]) {
        case 'my-name-key':
            myName = arguments[n1 + 1];
        };
    };
    var myName = 'undefined' === typeof myName ? 1 : myName;
    return myName;
};

And now looks like:

function helloWorld() {
    nilBlock: {
        var _js2 = arguments.length;
        for (var n1 = 0; n1 < _js2; n1 += 2) {
            switch (arguments[n1]) {
            case 'my-name-key':
                myName = arguments[n1 + 1];
            };
        };
    };
    var myName = 'undefined' === typeof myName ? 1 : myName;
    return myName;
};

I need a bit of time to think about the right way to fix that
(probably by fixing block not to emit if the body contains no return,
since it is all lexical), but in the meantime I haven't pushed patches
0003 and 0004.

BTW, I noticed this when I ran the tests: (asdf:load-system
:parenscript.test) (ps-test:run-tests)

Currently there's not a lot of tests for LOOP itself, so if anyone
wants to contribute some test cases, that would be great.

Thank you,
Vladimir

PS - I'm back and I'll try to address the other threads that came up
on the mailing list soon.

On Mon, Jul 16, 2012 at 11:45 AM, Boris Smilga <boris.smilga at gmail.com> wrote:
> On Mon, Jul 16, 2012 at 3:43 PM, Boris Smilga <boris.smilga at gmail.com> wrote:
>> please find attached three patches
>
> s/three/four/
>
> _______________________________________________
> 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