Path: utzoo!mnetor!uunet!husc6!uwvax!oddjob!ncar!ames!pasteur!ucbvax!SUMEX-AIM.STANFORD.EDU!SCHMIDT From: SCHMIDT@SUMEX-AIM.STANFORD.EDU (Christopher Schmidt) Newsgroups: comp.sys.xerox Subject: Re: defvar under Lyric Message-ID: <12384217868.75.SCHMIDT@SUMEX-AIM.Stanford.EDU> Date: 22 Mar 88 01:00:32 GMT References: <8803211018.aa17239@VIM.BRL.ARPA> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 27 I don't agree with the generalization "...that the def constructs apply to global variables." DEFVAR proclaims a variable special (CLtL, p 68.). Common Lisp lacks a global variable declaration mechanism (a serious omission, in my opinion), so Xerox Lisp provides XCL:DEFGLOBALVAR analogous to DEFVAR, that proclaims variables global instead of special. (I.e. compiled code uses the GVAR opcode which is much more efficient than the FVAR opcode.) Although your letter spelled out the implications of the following inequality, I think it bears repeating that (DEFVAR FOO 23) is not equivalent to (PROCLAIM '(SPECIAL FOO)) (SETQ FOO 23) because DEFVAR sets FOO only if it is unbound. By the same token (XCL:DEFGLOBALVAR FOO 23) is not equivalent to (PROCLAIM '(XCL:GLOBAL FOO)) (SETQ FOO 23) People writing portable Common Lisp code must write some ugly conditional proclamations, I suspect, if they want good performance. I hope your letter alerts some programmers to the pitfalls of DEFVAR. [I have little experience writing portable code, personally.] --Christopher -------