Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!quintus!pds From: pds@quintus.UUCP (Peter Schachte) Newsgroups: comp.lang.lisp Subject: Re: Structure editors in common lisp Message-ID: <490@cresswell.quintus.UUCP> Date: 22 Dec 87 18:52:04 GMT References: <1487@orstcs.CS.ORST.EDU> <464@cresswell.quintus.UUCP> <215@aiva.ed.ac.uk> Organization: Quintus Computer Systems, Mountain View, CA Lines: 42 Summary: CLtL doesn't mention some easy ways to loose print/read consistency In article <215@aiva.ed.ac.uk>, jeff@aiva.ed.ac.uk (Jeff Dalton) writes: > In article <464@cresswell.quintus.UUCP> pds@quintus.UUCP (Peter Schachte) writes: > >The CommonLisp book talks about trying to maintain Write/Read > >consistency, but doesn't mention that CommonLisp fails to do this > >because of packages. > > The book discusses the consistencey rules on page 173. You will note > that it specifies the conditions under which these rules remain true > and the sorts of "explicit action" that can cause them to become false. > > So I have to disagree with the claim that CLtL doesn't mention the > consistency problems caused by packages. You're right, it does mention consistency on page 173. But it fails to mention some simple, natural ways you call loose print/read consistency without using any of the "dangerous" functions mentioned. Here's an example: You have packages FOO and BAR. FOO USEs BAR. BAR exports a symbol SYM. BAR is defined on file BAR.LSP, and FOO in FOO.LSP. Ok, you write out a file SYM.LSP containing the symbol BAR:SYM with *PACKAGE* set to FOO. Next day, you start up a fresh Lisp, load FOO.LSP, SYM.LSP, and BAR.LSP, in that order. Now the occurrance of SYM on SYM.LSP turned into FOO:SYM, rather than BAR:SYM. I didn't have to call any of the "dangerous" functions to shoot myself in the foot, all I had to do was not have EXACTLY the same environment when the file was read as I had when it was written. Yes, of course, I shouldn't do this. But it's so EASY to do without knowing it. The only way to be really safe is to set *PACKAGE* to LISP before writing out a file. Then, as long as you don't change LISP (which you shouldn't do), you're safe. All the symbols not in the LISP package will be explicitly package qualified in the file. But that really defeats the purpose of packages: to give you a way to have long names without having to write and read them all the time. This is not a purely academic or theoretical argument. This type of problem has cost me many hours and caused me many problems. -- -Peter Schachte pds@quintus.uucp ...!sun!quintus!pds