find-class not using environment

Bug #1669030 reported by Philipp Marek
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

http://www.lispworks.com/documentation/HyperSpec/Body/f_find_c.htm has an environment arg, but SBCL doesn't seem to use it.

For example, I believe that this code in a file should be able to find and print the class during a "compile-file" operation:

  (defmacro ggg (name &environment env)
      (format *trace-output* "cls ~s ~s~&"
              name
              (find-class name nil env))
      nil)

  (defclass foo6 ()
    ())

  (ggg foo6)

For SBCL the output I get is NIL; eg. ECL correctly gives me "#<The STANDARD-CLASS COMMON-LISP-USER::FOO6>".

Thanks a lot!

Revision history for this message
Stas Boukarev (stassats) wrote :

But SBCL has no compilation environment.

Revision history for this message
James Kalenius (aeshtaer) wrote :

I've run into this myself. The problem isn't that find-class ignores the compilation environment, which is fine as stassats said, but that defclass doesn't have compile-time effects that it ought to. CLHS says

"If a defclass form appears as a top level form, the compiler must make the class name be recognized as a valid type name in subsequent declarations (as for deftype) and be recognized as a valid class name for defmethod parameter specializers and for use as the :metaclass option of a subsequent defclass. The compiler must make the class definition available to be returned by find-class when its environment argument is a value received as the environment parameter of a macro."

SBCL does make it known as a type, and allowed as a :metaclass, but it doesn't seem to exist as an actual class accessible by find-class. Doing so is obscure but pretty explicitly allowed, and works on e.g. ECL and CCL.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.