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

arg lists to APPLY

	I haven't checked the manuals for T or Scheme but it was certainly the
	intent that the list passed to APPLY is unrelated to the list that a
	rest-parameter gets bound to.  The rest-list should always be freshly
	consed, so e.g. the procedure LIST is equivalent to (LAMBDA X X).  The
	last argument to APPLY must be a proper list.  I think Common Lisp
	takes the same stance.
    This question came up recently on the Common-Lisp mailing list.  The
    unofficial consensus, as I understood it, was that the book is vague on
    this point and requires correcting; that the last argument to APPLY
    should be a proper list; and that a list passed as an argument to APPLY
    might or might not share list structure with an eventual &REST argument
    resulting from the application.

Until this discussion I had never heard anyone suggest that it was ok for
an implementation of Scheme to allow the list passed to APPLY to share
structure with the list that a rest-argument gets bound to.

For what it's worth, two formal semantics for Scheme have been published
(1980 and 1984) and a third is expected to be published soon.  The first
two define the domain of procedures as F = E* --> K --> C, and the third
defines F = L x (E* --> K --> C).  The sharing mentioned above is
inconceivable with either definition, and the changes that would be
required to allow such sharing are pretty gross.

In my opinion, therefore, Scheme and Common Lisp diverge on this as on
many other issues.

It should not be very difficult for a compiler to arrange things so that
rest arguments that are merely passed on as argument lists to APPLY never
get consed.  Whether this is important enough to worry about is another
matter entirely.

Peace, Will