find-class not using environment

Bug #1669030 reported by Philipp Marek on 2017-03-01
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description 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~&"
              (find-class name nil env))

  (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!

Stas Boukarev (stassats) wrote :

But SBCL has no compilation environment.

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  Edit
Everyone can see this information.

Other bug subscribers