Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!news.duke.edu!news-feed-1.peachnet.edu!gatech!psuvax1!rutgers!att-out!nntpa!nntpa.cb.att.com!lgm
From: lgm@polaris.ih.att.com (Lawrence G. Mayka)
Subject: Re: SETF (was ... a bunch of things)
In-Reply-To: lou@cs.rutgers.edu's message of 25 Oct 1994 14:08:40 -0400
Message-ID: <LGM.94Oct26171951@polaris.ih.att.com>
Sender: news@nntpa.cb.att.com (Netnews Administration)
Nntp-Posting-Host: polaris.ih.att.com
Organization: AT&T Bell Laboratories, Naperville, Illinois, USA
References: <Cxxwx0.1nC@rheged.dircon.co.uk> <hbakerCy17CC.vx@netcom.com>
	<Cy3E67.42K@rheged.dircon.co.uk> <Cy5Bv7.JDy@cogsci.ed.ac.uk>
	<Cy62A5.5G7@rheged.dircon.co.uk>
	<LOU.94Oct25140834@atanasoff.rutgers.edu>
Date: Wed, 26 Oct 1994 22:19:51 GMT
Lines: 33

In article <LOU.94Oct25140834@atanasoff.rutgers.edu> lou@cs.rutgers.edu (Lou Steinberg) writes:

   The best I can come up with to explain "when setf is dangerous" is
   that it is dangerous when two conceptually different "things" can
   share substructure and you are operating on the substructure of a
   thing.  It is simply much more common that things made of lists share
   substructure than things made of records.

Yes, the difficulty is that (possibly nested) lists are so often used
as "glue"--as the medium of intercommunication between the parts of a
large program, particularly in the rapid prototyping phase.  One part
of the program may incrementally build up such a tree (possibly from
preexisting local lists), then pass it (by reference) to another part
of the program.  Any subsequent (destructive) modification of the tree
or any substructure from which it was built, by either the sending or
receiving program-part, can have unexpected consequences, particularly
for novices.  For this reason, I, too, often advise a newcomer against
destructive operation on list structure unless he/she is very certain
that such structure was not previously passed (by reference) to or
from another part of the program.  Otherwise, people tend to resort to
the ugly and inefficient workaround of incessantly copying list
structures in the morbid fear that someone else might modify the
original later.

In retrospect, it might have been useful for Common Lisp to
distinguish mutable from immutable list structures as distinct
datatypes.
--
        Lawrence G. Mayka
        AT&T Bell Laboratories
        lgm@ieain.att.com

Standard disclaimer.
