Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!know!zaphod.mps.ohio-state.edu!uwm.edu!bionet!agate!shelby!neon!neon!gumby From: gumby@Cygnus.COM (David Vinayak Wallace) Newsgroups: comp.lang.lisp Subject: Constants in code (Ex- Virtues of Lisp syntax) Message-ID: Date: 22 Sep 90 22:07:17 GMT References: <20692@well.sf.ca.us> <2862943796@ARTEMIS.cam.nist.gov> Sender: news@Neon.Stanford.EDU (USENET News System) Followup-To: comp.lang.lisp Organization: Cygnus Support Lines: 39 In-Reply-To: miller@GEM.cam.nist.gov's message of 21 Sep 90 22:09:56 GMT Date: 21 Sep 90 22:09:56 GMT From: miller@GEM.cam.nist.gov (Bruce R. Miller) Larry Masinter wrote: >[As a side note, many learning LISP programmers frequently do > encounter self-modifying code and are mystified by it, e.g., > (let ((var '(a b c))) > ... > (nconc var value)) Without digging thru CLtL to determine its legality, it seems pretty clear that it is unclear what it SHOULD do! And that different interpreters/compilers will make different choices. And that the Committee probably didn't even want to specify. In any case, one could imagine a perfectly legitimate interpretter consing the list fresh every time, giving a 3rd behavior. Before you groan, consider that this might in fact be the most consistent behavior! The (QUOTE (A B C)) form is (conceptually, at least) evaluated each time the function is called! Should (QUOTE (A B C)) sometimes return (A B C FOO)? The interpretation of either case is straightforward. Quote returns the object it was handed. It doesn't try to guess "what you meant." After all, the code isn't text; quote just has a pointer to the car of the list you handed it! I would be unhappy if quote performed computation each time you used it! A very common idiom is to pass a quoted, uninterned symbol around as a marker in some structure. (I used to use '(())). This is the only way I can get a token I guarantee won't appear in my input stream! Anyway, the capability to side-effect constants in storage was not removed for taste reasons, but efficiency; it permits me as a lisp implementor to place code into read-only storage (and possibly share it among processes).