(describe (allocate-instance (find-class 'standard-class))) signals an error

Bug #1796514 reported by Michał Herda on 2018-10-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

CL-USER> (describe (allocate-instance (find-class 'standard-class)))
#<STANDARD-CLASS {10133FA453}> ;; this is printed
  [standard-object] ;; this is printed

And then an error is signaled:

The slot SB-PCL::NAME is unbound in the object
#<STANDARD-CLASS {10133FA453}>.
   [Condition of type UNBOUND-SLOT]

Restarts:
 0: [USE-VALUE] Return a value as the slot-value.
 1: [STORE-VALUE] Store and return a value as the slot-value.
 2: [RETRY] Retry SLIME REPL evaluation request.
 3: [*ABORT] Return to SLIME's top level.
 4: [ABORT] abort thread (#<THREAD "new-repl-thread" RUNNING {100DA75C93}>)

Backtrace:
  0: ((:METHOD SLOT-UNBOUND (T T T)) #<unused argument> #<STANDARD-CLASS {10133FA453}> SB-PCL::NAME) [fast-method]
      Locals:
        SB-KERNEL:INSTANCE = #<STANDARD-CLASS {10133FA453}>
        SB-PCL::SLOT-NAME = SB-PCL::NAME
  1: (SLOT-VALUE #<STANDARD-CLASS {10133FA453}> SB-PCL::NAME)
      Locals:
        SB-PCL::OBJECT = #<STANDARD-CLASS {10133FA453}>
        SB-PCL::SLOT-NAME = SB-PCL::NAME
  2: (SB-IMPL::DESCRIBE-CLASS NIL #<STANDARD-CLASS {10133FA453}> #<SWANK/GRAY::SLIME-OUTPUT-STREAM {100C4EDEB3}>)
      Locals:
        CLASS = #<STANDARD-CLASS {10133FA453}>
        NAME = NIL
        STREAM = #<SWANK/GRAY::SLIME-OUTPUT-STREAM {100C4EDEB3}>
  3: ((:METHOD DESCRIBE-OBJECT (CLASS T)) #<STANDARD-CLASS {10133FA453}> #<SWANK/GRAY::SLIME-OUTPUT-STREAM {100C4EDEB3}>) [fast-method]
      Locals:
        SB-IMPL::OBJECT = #<STANDARD-CLASS {10133FA453}>
        STREAM = #<SWANK/GRAY::SLIME-OUTPUT-STREAM {100C4EDEB3}>
  4: (DESCRIBE #<STANDARD-CLASS {10133FA453}> #<SWANK/GRAY::SLIME-OUTPUT-STREAM {100C4EDEB3}>)
      Locals:
        SB-IMPL::OBJECT = #<STANDARD-CLASS {10133FA453}>
        SB-KERNEL:STREAM-DESIGNATOR = #<SWANK/GRAY::SLIME-OUTPUT-STREAM {100C4EDEB3}>
  5: (SB-INT:SIMPLE-EVAL-IN-LEXENV (DESCRIBE (ALLOCATE-INSTANCE (FIND-CLASS #))) #<NULL-LEXENV>)
      Locals:
        SB-KERNEL:LEXENV = #<NULL-LEXENV>
        SB-IMPL::ORIGINAL-EXP = (DESCRIBE (ALLOCATE-INSTANCE (FIND-CLASS 'STANDARD-CLASS)))
  6: (EVAL (DESCRIBE (ALLOCATE-INSTANCE (FIND-CLASS #))))
      Locals:
        SB-IMPL::ORIGINAL-EXP = (DESCRIBE (ALLOCATE-INSTANCE (FIND-CLASS 'STANDARD-CLASS)))

Douglas Katzman (dougk) wrote :

Are you suggesting that NAME should not be initially unbound, or that describe should print 'unbound'? As is, this seems at worst a minor inconvenience, not an actual bug. There a zillion ways to create objects whose state is incomplete for some other operation.

Michał Herda (phoe-krk) wrote :

I suggest that it should be initially unbound (as per ALLOCATE-INSTANCE protocol, and as it is now), but DESCRIBE should not signal an error. CLHS states that DESCRIBE isn't supposed to signal errors.

A practical fix for DESCRIBE would be, print the name of the class as 'unbound'

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

Other bug subscribers