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

bug in setf documentation

The Franz manual carefully defines
	(setf g_refexpr 'g_value)
to return g_value.  Unfortunately, this is not true.  If g_refexpr
ultimately refers to the car or cdr of a list cell, the value returned
will be the modified cell, not its car or cdr.  Similarly, if g_refexpr
is a cxr of a hunk, the entire hunk is returned.

The examples which accompany setf in the manual make clear what is
happening.  The returned value is the result of the rplac[adx]
generated by the setf macro.  Unfortunately, in Franz and most other
Lisps the value returned by the rplac[adx] functions is inconsistent
with that returned by the various modifier functions for symbols,
arrays, and vectors.

All this is unfortunate, as one of the main reasons for setf is to
insulate code from the representation of an object such as might be
defined, for example, by defstruct.

The proper fix is to change the manual.  If one were so bold as to
plagarize a sentence from the (MIT) Lisp Machine Manual:

	"[T]he value produced by setf depends on the structure type and
	 is not guaranteed;  setf should be used for side effect only."

Steve Haflich
MIT Experimental Music Studio
decvax!genrad!mit-ems!smh, smh@mit-ems@mit-mc