Subject: Re: All instances From: Erik Naggum <firstname.lastname@example.org> Date: Mon, 18 Jun 2001 00:00:23 GMT Newsgroups: comp.lang.lisp Message-ID: <email@example.com> * Huaiyuan <firstname.lastname@example.org> > 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.