gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] DO-SYMBOLS and DO-ALL-SYMBOLS don't have implicit


From: Paul F. Dietz
Subject: Re: [Gcl-devel] DO-SYMBOLS and DO-ALL-SYMBOLS don't have implicit tagbodies
Date: Fri, 18 Oct 2002 18:45:31 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408

Camm Maguire wrote:
Greetings!  I've just committed a fix (I hope) to the setf values
issue.  There are two remaining failues now in places.lsp, both
involving psetq/psetf.  I don't understand what is going wrong, and am
not sure if the test is correct.  I'd greatly appreciate some
elaboration here.

This is a test of proper evaluation order.

First, note that PSETQ, like SETQ, behaved like PSETF (SETF) when
assigning to a symbol macro:

   " If any var refers to a binding made by symbol-macrolet, then
     that var is treated as if psetf (not psetq) had been used. "

Now, PSETF says:

   "  For psetf, if more than one pair is supplied then the assignments
    of new values to places are done in parallel. More precisely, all
    subforms (in both the place and newvalue forms ) that are to be
    evaluated are evaluated from left to right; after all evaluations
    have been performed, all of the assignments are performed in an
    unpredictable order. "

So, this form:

(symbol-macrolet ((x (aref a (incf i)))
                    (y (aref a (incf i))))
    (let ((a (copy-seq #(0 1 2 3 4 5 6 7 8 9)))
          (i 0))
      (psetq x (aref a (incf i))
             y (aref a (incf i)))
      (values a i)))

is equivalent to

    (let ((a (copy-seq #(0 1 2 3 4 5 6 7 8 9)))
          (i 0))
      (psetf (aref a (incf i)) (aref a (incf i))
             (aref a (incf i)) (aref a (incf i)))
      (values a i))

which is equivalent to

    (let ((a (copy-seq #(0 1 2 3 4 5 6 7 8 9))))
      (psetf (aref a 1) (aref a 2)
             (aref a 3) (aref a 4))
      (values a 4))

which should return

      #(0 2 2 4 4 5 6 7 8 9)
      4

        Paul






reply via email to

[Prev in Thread] Current Thread [Next in Thread]