Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cs.utexas.edu!wasatch!utah-gr!uplherc!sp7040!obie!wsccs!dharvey From: dharvey@wsccs.UUCP (David Harvey) Newsgroups: comp.lang.lisp Subject: Re: Question about eval Summary: Redefing EVAL is nasty NO-NO! Message-ID: <747@wsccs.UUCP> Date: 24 Oct 88 02:22:48 GMT References: <13733@iuvax.cs.indiana.edu> Lines: 41 In article <13733@iuvax.cs.indiana.edu>, dfried@iuvax.cs.indiana.edu (Dan Friedman) writes: > Are there any LISP implementations, especially of Common LISP, > which get 5 instead of 1 as the result of the following run? > > >>> (defun eval (x) 1) > eval > > >>> 5 > 1 > Yes, VAX' Common Lisp will return the value of 5. It will also not let you so cavalierly redefine this system primitive. It sqwawks about it in no uncertain terms before allowing you to hang yourself. 5 returns 5, and (eval anyentity) returns 1. If you do an explicit eval of anthing over or less than 1 arg it will complain now. > Does this change to eval ever change what load does? > > Does (setf (symbol-function 'eval) #'(lambda (x) 1)) > do exactly the same thing as (defun eval (x) 1) in all > Common Lisp implementations? > > ... Dan Unfortunately, VAX Common Lisp will not sqwawk at you when you redefine in this manner. It accomplishes the same results as above. Although I have not tried this with any other Common Lisp, the results of the setf and the defun should be the same on all machines, since the defun is nothing more than a macro that expands to the setf. Oops, check that. This assumes that setf and defun are both found in package Lisp. Where else would they be? dharvey aliases: Lispin' Dave Hacker Horribulus I am responsible for Nobody, and Nobody is responsible for me. The only thing you can know for sure, is that you can't know anything for sure.