[parenscript-devel] Bug: inconsistent gensym suffixes on what ought to be the same loop control variable

Vladimir Sedach vsedach at gmail.com
Sat Sep 15 22:22:54 UTC 2012


Thanks for that bug report Dan. I'm not sure why that didn't come up earlier.

I fixed the problem by getting rid of the whole loopResultVar thing -
with the new RETURN transformations values can be returned directly,
and that simplifies the generated code (and the Parenscript compiler)
a lot.

The fix is now pushed.

Vladimir

On Fri, Sep 14, 2012 at 1:32 AM, Daniel Gackle <danielgackle at gmail.com> wrote:
> I just ran into a strange bug where the gensym'd suffixes on loop
> control variables change to the wrong thing. The bug appears to be
> triggered by a (RETURN) form inside a loop that has more than one
> FOR clause. For each extra clause, the suffixes increase by one.
> I haven't tried to track down the cause of the bug, but I did just push
> a failing test (LOOP-PARALLEL-CLAUSES-WITH-RETURN) to
> illustrate it.
>
>   (defun-js foo ()
>     (loop :for i :from 0 :below 10 :for x = (* i 10)
>       :when (> i 5) :do (return x)
>       :collect i))
>
> => (note added comments below):
>
>   function foo() {
>       return (function () {
>           var collect3170 = [];
>           var loopResultVarSet3171 = null;
>           var loopResultVar3172 = null;
>           for (var i = 0; i < 10; i += 1) {
>               var x3171 = i * 10;
>               if (i > 5) {
>                   loopResultVarSet3172 = true;  // <---- suffix should be
> 3171, not 3172
>                   loopResultVar3173 = x3171;    // <---- suffix should be
> 3172, not 3173
>                   break;
>               };
>               collect3170.push(i);
>           };
>           if (loopResultVarSet3171) {
>               return loopResultVar3172;
>           };
>           return collect3170;
>       })();
>   };
>
> Daniel
>
>
> _______________________________________________
> 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