From: Wolfhard Bu�
Subject: loop with destructering and initialization
Date: 
Message-ID: <m3k8e5hywf.fsf@minka.katzen.ol>
Agreeing on the interpretation of

(loop with (a . b) of-type float = '(0.0 . 1.0)
  return (list a b))

different implementations of Lisp disagree on

(loop with (a . b) of-type float = '(0.0 . 1.0)
  and (c . d) of-type float = '(2.0 . 3.0)
  return (list a b c d))

signaling an undefined function "a" or returning

(0.0 1.0 2.0 3.0).

Why? Do both interpretations conform to the standard?


-wb
From: Tim Bradshaw
Subject: Re: loop with destructering and initialization
Date: 
Message-ID: <ey3zon183fb.fsf@cley.com>
* Wolfhard Bu� wrote:
> different implementations of Lisp disagree on

> (loop with (a . b) of-type float = '(0.0 . 1.0)
>   and (c . d) of-type float = '(2.0 . 3.0)
>   return (list a b c d))

> signaling an undefined function "a" or returning

> (0.0 1.0 2.0 3.0).

I think that this latter is right, but LOOP is fairly  hairy.  The
grammar for WITH is:


 with-clause::= with var1 [type-spec] [= form1] 
	        {and var2 [type-spec] [= form2]}*

And var1 and var2 are both d-var-specs, where

 d-var-spec::= simple-var | nil | (d-var-spec . d-var-spec) 


So I think it's reasonably clear it should work.  What seems to be
going on in the implementation I tried is that things are expanding
into something like

 (destructuring-bind (a . b) ... (c . d) ...)

analogously to how LET would work, but this is obviously wrong
(actually stuff is reversed).  The correct expansion is much more
hairy, it would have to be something like:

 (destructuring-bind (#:g1 . #:g2) ...
   (destructuring-bind (#:g3 . #:g4) ...
     (let ((a #:g1) (b #:g2) (c #:g3) (d #:g4))
       ...)))

With the obvious gensyms being EQ, to preserve the parallel-binding
semantics.

--tim