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

&rest replacement/addition



In view of all of the recent furor about &rest, perhaps, as Mr. Gooch
suggests, a different mechanism is in order.  I'd like to suggest one,
as a starting point for discussion. This idea may have been discussed
already, or maybe even implemented somewhere, but I'll suggest it
anyway.  We need a way to have indefinite numbers of arguments, without
the overhead and semantic problems inherent in consing up (or not
consing up) lists.  How about a new lambda-list keyword, maybe
&more-args, and a couple of special forms to deal with them, DO-ARGS
and NEXT-ARG, maybe ARGS-TO-LIST even.  So you'd have code like the following:

(defun fu (a &more-args)
   (do-args (arg)
      ...code...
      (moby-calculation a arg)
      ...more code...
    ))

etc...

The nice thing about this is that the implementation can do whatever it
wants with things, shove them on the stack, save APPLY lists, etc., and
the semantics remain clean.  The disadvantage is that this introduces
more 'side-effecting' semantics into the language, but then, Common
Lisp was never too clean on that score anyway.

What do you all think?

	-Sean Engelson-
	Carnegie-Mellon University