SUBTYPEP problem with hairy classes

Bug #310212 reported by Nikodemus Siivola
2
Affects Status Importance Assigned to Milestone
SBCL
Incomplete
Medium
Unassigned

Bug Description

Reported by Lars Rune Nøstdal on sbcl-devel 2008-10-24.

SUBTYPEP sometimes signals an error when Contextl calls it to determine subclass relationships, causing the problems seen below (since Contextl assumes that SUBTYPEP signalling an error means NIL, basically.) The questions Contextl puts to SUBTYPEP seem answerable, and should not signal an error.

Test case below. To trigger the problem on a new Contextl replace SUBCLASSP tests in contextl with SUBTYPEP, SUBCLASSP there is a workaround for this SBCL bug.

        (eval-when (:compile-toplevel :load-toplevel :execute)
          (lfmakunbound 'name-of) ;; If I comment this out and eval the buffer or load the file twice, things work.
          (unintern 'person)
          (unintern 'address-mixin))

        (define-layered-class person ()
          ((name :accessor name-of
                 :initarg :name
                 :initform "name")))

        (deflayer address-mixin)
        (define-layered-class address-mixin :in address-mixin ()
          ((address :accessor address-of
                    :initarg :address
                    :initform "address")))

        (define-layered-class person :in address-mixin (address-mixin)
          ())

..backtrace:

        While computing the class precedence list of the class named PERSON.
        It is not possible to compute the class precedence list because
        there are circularities in the local precedence relations.
        These arise because:
          The class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BEC9D81}> appears in the supers of the class named ADDRESS-MIXIN.
          The class named SPECIAL-OBJECT appears in the supers of the class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BEC9D81}>.
          The class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BED6241}> follows the class named SPECIAL-OBJECT in the
supers of the class named PERSON.
          The class named ADDRESS-MIXIN appears in the supers of the class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BED6241}>.
          The class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BED1C41}> appears in the supers of the class named ADDRESS-MIXIN.
          The class #<SPECIAL-LAYERED-ACCESS-CLASS NIL {BEC9D81}> follows the class
#<SPECIAL-LAYERED-ACCESS-CLASS NIL {BED1C41}> in the supers of the class named ADDRESS-MIXIN..
           [Condition of type SIMPLE-ERROR]

        Restarts:
         0: [RETRY] Retry SLIME interactive evaluation request.
         1: [ABORT] Return to SLIME's top level.
         2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "worker" RUNNING {BE5BA61}>)

        Backtrace:
          0: (SB-PCL::CPL-ERROR #<LAYERED-CLASS PERSON> "It is not possible to compute the class precedence list
because~@\n there ~A in the local precedence relations.~@\n ~A because:~{~% ~A~}.")[:EX..
          1: (SB-PCL::COMPUTE-STD-CPL-PHASE-3 ..)
          2: (SB-PCL::MAKE-PRELIMINARY-LAYOUT #<LAYERED-CLASS PERSON>)
          3: (SB-PCL::MAKE-PRELIMINARY-LAYOUT #<LAYERED-CLASS PERSON>)[:EXTERNAL]
          4: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-PCL::.ARG1. SB-INT:&MORE
SB-PCL::.DFUN-MORE-CONTEXT. SB-PCL::.DFUN-MORE-COUNT.)) ..)
          5: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE (SB-PCL::SLOT-OBJECT)) #<unavailable argument>
#<unavailable argument> #<LAYERED-CLASS PERSON>)[:EXTERNAL]
          6: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. SB-INT:&MORE
SB-PCL::.DFUN-MORE-CONTEXT. SB-PCL::.DFUN-MORE-COUNT.)) ..)
          7: ((FLET CALL-NEXT-METHOD))
          8: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE :AROUND (STANDARD-CLASS-IN-LAYER)) ..)[:EXTERNAL]
          9: ((FLET CALL-NEXT-METHOD))
         10: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE :AROUND (SPECIAL-CLASS)) ..)[:EXTERNAL]
         11: ((FLET CALL-NEXT-METHOD))
         12: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE :AROUND (LAYERED-ACCESS-CLASS)) ..)[:EXTERNAL]
         13: ((FLET CALL-NEXT-METHOD) ..)
         14: ((SB-PCL::FAST-METHOD REINITIALIZE-INSTANCE :AROUND (PARTIAL-CLASS)) ..)[:EXTERNAL]
         15: ((SB-PCL::FAST-METHOD SB-MOP:ENSURE-CLASS-USING-CLASS (SB-PCL::PCL-CLASS T)) #<unavailable
argument> #<unavailable argument> #<LAYERED-CLASS PERSON> PERSON)[:EXTERNAL]
         16: (SB-PCL::REAL-LOAD-DEFCLASS PERSON LAYERED-CLASS (ADDRESS-MIXIN) NIL (:IN-LAYER
ADDRESS-MIXIN) NIL NIL NIL #S(SB-C:DEFINITION-SOURCE-LOCATION :NAMESTRING NIL
:TOPLEVEL-FORM-NUMBER NIL :PLIST NIL) T)
         17: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-PCL::LOAD-DEFCLASS 'PERSON '

Tags: pcl types
Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Douglas Katzman (dougk) wrote :

'define-layered-class' and 'deflayer' - what are these?
Closing as incomplete due to age of the report and non-self-containedness of the example

Changed in sbcl:
status: Confirmed → Incomplete
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.