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

Uniqueness of &rest arguments

    Date: 28 Oct 1985 15:32-EST

    Are &rest arguments guaranteed to be copied?  Consider the following:

	(defmacro m (&rest args)
	     `',(nreverse args)        ; Destructive reverse
	(setq x '(m a b c d))
	(eval x)

    What is the final value of x?   I think that I would argue that
    it is undefined since args may or may not be a copy of the original
    form.   Is there anything in Cttl that clarifies this?

    -- Dan

I cannot find any place in the manual that addresses this point.  The
text describing APPLY alludes to appending the last argument to APPLY to
a list of all other arguments (except the function, of course), and so
one might think, referring to the definition of APPEND, that the
resulting list of arguments might contain actual cons cells from the
list that is the last argument to APPLY.  However, nothing addresses
whether a &REST argument might share with this list.

My own opinion is that indeed the args might not be a copy of the
original form, but I regard this as a non-trivial clarification worthy
of discussion.