[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Structure sharing
Date: 18 Jun 1986 23:08-EDT
From: NGALL@G.BBN.COM
KCL recently surprised me with the following behavior:
(setf foo 'filename) => FILENAME
(setf bar (namestring foo)) => "FILENAME"
(setf bar (nstring-downcase bar)) => "filename"
foo => {causes error}
It seems that in KCL. namestring of a symbol merely returns a
simple-string whose characters are SHARED with the print-name of the
symbol FILENAME!
Date: Wed, 18 Jun 1986 23:35 EDT
From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>
Page 168:
"It is an extremely bad idea to modify a string being used as the print
name of a symbol. Such a modification may tremendously confuse the
function READ and the package system."
Does this tell us whether the behavior of NAMESTRING in KCL is valid
or invalid? I think it's valid, but nothing in the manual directly
supports that claim.
From: NGALL@G.BBN.COM again
I think it would be a good idea for CLtL to explicity state that
unless otherwise noted, a given function may return an object that
shares structure with another object. And it would help to give a few
examples like parse-namestring and namestring to point out the
non-obvious consequences.
It sounds like the agenda of language clarifications ought to include
such an item.