Language standards for LispOS

Marc Wachowitz mw@ipx2.rz.uni-mannheim.de
Wed, 21 May 97 22:59:02 +0200


hbaker@netcom.com (Henry G. Baker) wrote:
> I'd like to find out who uses &rest mutation, other than the beast who
> defines list as
> 
> (defun list (&rest l) l)

In fact, the beast would be wrong, as &REST is allowed to share structure
with the last argument of APPLY, and LIST must still return a freshly
allocated list when called from APPLY. Of course, one could nevertheless
define some PRIVATE-LIST this way, if one didn't worry about sharing.

> Really, someone who depends upon the mutable properties of &rest lists
> should be taken out & shot, right?

I'm too peaceful for that, but something like tracing the execution of
an optimizing Common Lisp compiler (applied to itself) on paper would be
an appropriate punishment.

To protect the innocent user of such horrible software, one might simply
provide a compiler switch (via a declaration/proclamation) which tells
the compiler to generate mutable &REST lists, without any extraordinary
effort at optimizing it away, but use immutable &REST lists by default.

(DECLAIM (LISPOS:MUTABLE-&REST :SANE-DEFAULT))
vs.
(DECLAIM (LISPOS:MUTABLE-&REST :PEDANTIC))

That's an old trick to satisfy language lawyers: Define the "standard"
implementation to be invoked by starting your optimized version and then
switching off the optimization ;-)

-- Marc Wachowitz <mw@ipx2.rz.uni-mannheim.de>