From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!ossa.telenet-ops.be!nslave.kpnqwest.net!nloc2.kpnqwest.net!nloc.kpnqwest.net!nmaster.kpnqwest.net!nreader2.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: weird function behavior References: <3230400393774701@naggum.net> <4d6vxnnc3.fsf@beta.franz.com> <4g00s7oc4.fsf@beta.franz.com> Mail-Copies-To: never From: Erik Naggum Message-ID: <3230559216909207@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 51 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 16 May 2002 17:33:37 GMT X-Complaints-To: newsmaster@KPNQwest.no X-Trace: nreader2.kpnqwest.net 1021570417 193.71.199.50 (Thu, 16 May 2002 19:33:37 MET DST) NNTP-Posting-Date: Thu, 16 May 2002 19:33:37 MET DST Xref: archiver1.google.com comp.lang.lisp:33401 * Duane Rettig | Note here (in Allegro CL): | | CL-USER(2): (defun foo () (eq '(nil) '(nil))) | FOO | CL-USER(3): (foo) | NIL | CL-USER(4): (compile 'foo) | FOO | NIL | NIL | CL-USER(5): (foo) | T | CL-USER(6): | | Again, this does not necessarily show what can be expected, but | what should _not_ be expected. This is a great example to show why the consequences of modifying a literal are _undefined_. Even if it actually works to modify some part of the source code, or some object that is re-created when loading a compiled file, the compiler has a license to coalesce literals because they are not expected to be modified. E.g., a pathological example that may show just how messed up some of these things can get: (defmacro mumble (&body body) (list* 'let '((x '(nil))) body)) => mumble (defun fumble () (mumble (setf (car x) 0))) => fumble (mumble x) => (nil) (fumble) => 0 (mumble x) => (0) I leave it to the reader to figure out why it does not (generally) work with the more normal backquoted form of the macro body. -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief. 70 percent of American adults do not understand the scientific process.