Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!ukc!etive!aiai!jeff From: jeff@aiai.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: Simple question RE nested DEFUNs Message-ID: <665@skye.ed.ac.uk> Date: 2 Aug 89 11:13:38 GMT References: <89Jul31.114325edt.11243@ephemeral.ai.toronto.edu> <979@accuvax.nwu.edu> <86124@ti-csl.csc.ti.com> Reply-To: jeff@aiai.UUCP (Jeff Dalton) Organization: AIAI, University of Edinburgh, Scotland Lines: 34 In article <86124@ti-csl.csc.ti.com> gateley@m2.UUCP (John Gateley) writes: >In article <979@accuvax.nwu.edu> Krulwich@eecs.nwu.edu (Bruce Krulwich) writes: >>... Additionally, the semantics of >>DEFUN are clear: it always defines a global function. > >Not true: defun is a top level form; its semantics are defined only >in the case where it appears at top level (see CLtL chap 5). In the >case mentioned in the original article, the defun does not appear >at top level. Page 66 supports your view. Page 67, however, says: Evaluating a {\tt defun} form causes the symbol {\it name} to be a global name for the function specified by the lambda-expression (lambda ...) defined in the lexical environment in which the {\tt defun} form was executed. Because {\tt defun} forms normally apear at top level, this is normally the null lexical environment. It's possible to argue for a long time about whether page 66 or page 67 should win. X3J13 may have decided this one way or the other by now. But most implementations do allow {\tt defun} in non-top-level contexts. Note too that it's possible to come up with examples in which a non-top-level {\tt defun} is silly. But that doesn't show that every case is silly. And, indeed, there are times when non-top-level {\tt defun} makes sense. Jeff Dalton, JANET: J.Dalton@uk.ac.ed AI Applications Institute, ARPA: J.Dalton%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!J.Dalton