[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lexical closure bug?



    Date: Wed, 20 Oct 1993 18:50:29 -0400 (EDT)
    From: Robert Bruce Findler <robby+@CMU.EDU>
    Cc: info-mcl@cambridge.apple.com
    In-Reply-To: <9310201955.AA28493@cambridge.apple.com>

    > A different implementation of do, which used tail recursion instead of 
    > tagbody/go and so established a new binding of a for each iteration
    would have 
    > produced the result you expected.

    I see. Is do coded that way for a reason? To me, the way that MCL coded
    do seems counter-intuitive. I don't generally expect variables to
    changed out from under me. Is it much faster to be that way?

As I read CLtL2, p.165, binding on each iteration is explicitly disallowed.
(Of course, I don't know whether the ANSI standard reads this way.)

  "Before the first iteration, all the init forms are evaluated, and
   each var is bound to the value of its respective init.  
   This is a binding, not an assignment..."
---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  "At the beginning of each iteration other than the first, the index
   variables are updated as follows.  All the step forms are evaluated
   ...and the resulting values are assigned to the respective index variables."
-----------------------------------^^^^^^^^

-- Bob