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

misinformation about LOOP



    Date: 30 Aug 1982 0914-PDT
    From: Rod Brooks <ROD at SU-AI>

    I haven't looked at the complete new proposal, but in MOON's MACRO example:

    (DEFUN MACROEXPAND (FORM &AUX CHANGED)
      "Keep expanding the form until it is not a macro-invocation"
      (LOOP (MULTIPLE-VALUE (FORM CHANGED) (MACROEXPAND-1 FORM))
	    (IF (NOT CHANGED) (RETURN FORM))))

    one sees a fundamentally new scoping system in action. In all other binding
    mechanisms (e.g. LET, DO, MULTIPLE-VALUE-BIND, DEFUN and even PROG with
    init values) the CAR of a form identifies the form type as one which will
    do binding which will remain in effect only within that form, and at the
    same time says where in the form one can find the variables and what they
    will be bound to. In this example MULTIPLE-VALUE says where the variable
    names and the things that they will be bound to are (syntactically), but
    the scope of those bindings is determined by a context outside of the form
    with MULTIPLE-VALUE as its CAR. On the other hand while the symbol LOOP
    determines the scope of the bindings (in the example at least) it doesn't
    determine the syntactic location of the variables and what they get bound
    to.

This is confused.  Moon could just as easily have written:

(DEFUN MACROEXPAND (FORM &AUX CHANGED)
  "Keep expanding the form until it is not a macro-invocation"
  (DO ()
      (NIL)
    (MULTIPLE-VALUE (FORM CHANGED) (MACROEXPAND-1 FORM))
    (IF (NOT CHANGED) (RETURN FORM))))

There is no problem I can see with determining the scope of any bindings made
by LOOP.  In Moon's code LOOP made NO bindings.