From ... Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!134.222.94.5!npeer.kpnqwest.net!nreader1.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: All instances References: Mail-Copies-To: never From: Erik Naggum Message-ID: <3201811221875723@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 40 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 18 Jun 2001 00:00:23 GMT X-Complaints-To: newsmaster@Norway.EU.net X-Trace: nreader1.kpnqwest.net 992822423 193.71.66.150 (Mon, 18 Jun 2001 02:00:23 MET DST) NNTP-Posting-Date: Mon, 18 Jun 2001 02:00:23 MET DST Xref: archiver1.google.com comp.lang.lisp:11928 * Huaiyuan > For example, the following kludge works for CMUCL (assuming some value of > "works" which nonetheless should be adequate for explorative purposes): > > (defun unreliably-list-special-variables-in-package (package) > (do-symbols (sym package) > (when (search "special variable" > (with-output-to-string (*standard-output*) > (describe sym))) > (print sym)))) You may not be aware of this, but this uses an implementation-dependent feature that clearly depends on some other feature that you should have investigated and used instead of letting describe use it for you. I get this Perl feeling from your example: It is easier to parse textual output from some useful function to look for some random text string you think will return all true positive and no true negative than to go look for the real answer. Yecch! Here's a trivial example that shows you what kind of bad Perl solution you came up with: * (setq *top-level-auto-declare* nil) NIL * (setq foobar-random-noise '("this is not a special variable")) Warning: This variable is undefined: FOOBAR-RANDOM-NOISE ("this is not a special variable") * (describe 'foobar-random-noise) FOOBAR-RANDOM-NOISE is an internal symbol in the COMMON-LISP-USER package. It is a undefined variable; its value is ("this is not a special variable"). ("this is not a special variable") is a CONS. In CMUCL, the function walker:variable-globally-special-p takes a symbol and returns true if it is globally declared special. In Allegro CL, the function excl::variable-special-p does the same, but needs an environment, too. nil is the global environment, as usual. #:Erik -- Travel is a meat thing.