Subject: Re: Accessibility of symbols
From: Erik Naggum <erik@naggum.no>
Date: 12 Oct 2002 01:10:05 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3243373805862280@naggum.no>

* Matthew Danish
| Given that the current package is "FOO" and accessibility is defined to
| mean "does not need a package prefix to reference it", it seems to me
| that COMMON-LISP:ATOM is not accessible in package "FOO" and should not
| be returned by the above LOOP.

  I see absolutely nothing wrong with your reasoning here.  I am somewhat
  unhappy that the following code behaves correctly in Allegro CL 6.2:

(do-symbols (symbol)
  (when (string-equal symbol "ATOM")
    (print symbol)))

  because it does an explicit test for membership in the shadowed-symbols
  list in a package (see the expansion of the macro).

  The `loop´ form uses `with-package-iterator´, so the following form also
  exhibits the problem:

(with-package-iterator (get-symbol :foo :inherited)
  (loop
    (multiple-value-bind (flag symbol access package) (get-symbol)
      (when (string-equal symbol "atom")
        (print (list symbol access package)))
      (unless flag
        (return)))))

  Allegro CL 6.2 violates the standard when it does not obey the requirement
  that `:inherited´ returns symbols that are shadowed.  The requirement is
  that the symbols returned are specifically:

  The symbols that are exported by used packages and that are not shadowed.

  So Allegro CL and LispWorks contain a pretty serious bug in that they do
  not exclude shadowed symbols the way `do-symbols´ does.  It is pretty sad
  that the two forms use such radically different underlying mechanisms.

-- 
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.