CLIM mail archive
[Prev][Next][Index][Thread]
Re: clos object wierdness ..
Date: Wed, 16 Feb 1994 10:54:47 +0100
From: rudolf mittelmann <rm@cast.uni-linz.ac.at>
In message <9402150852.AA24012@iml.fhg.de> writes:
> Essentially, I'm doing the following:
>
> (defclass a () ())
> (defclass b () ())
> (defclass c () ())
>
> (defclass d (a b c) ())
> (define-presentation-type d (foo))
>
> As far as I understood this is not a correct p-type definition
> in CLIM. presentation type d MUST :inherit-from (a b c), as the
> presentation-type hierarchy must always "parallel" the clos class-
> hierarchy.
>
If I understand it right, you are wrong here: If you do not
define p-types *explicitly*, the p-types automatically parallel
the CLOS hierarchie.
You should define p-types explicitly in order to define
a *different* hierarchy, so this must be peerfectly legal.
In the rare case, that you want to define a p-type explicitly,
but of the default (CLOS) hierarchy, you have to supply
the full supertype list for the :inherit-from keyword.
I find it much easier to *not* define p-types explicitly.
My careful reading of the 1.1 documentation agrees with rm, not
berni. p.305 "If name is or names a CLOS class, then :inherit from
must specify the class's direct superclasses ..." but the second
paragraph states "If :inherit-from is unsupplied it defaults as
follows: If name is or names a CLOS class, then the type inherits
from the presentation type corresponding to the direct superclasses
of that CLOS class ..."
However, I've tried covering both cases, and the behavior is different
(if bogus).
The following is my "official" bug report (less most of the stack
trace):
Date: Tue, 15 Feb 1994 15:07-0500
Subject: MCL 2.0.1, CLIM 1.1 with patches 1 - 6 installed
To: clim-support@lucid.com, york@parc.xerox.com, doughty@ileaf.com
I'm having a lot of trouble, and I've spent many days worth of time
trying to isolate a small example which will generate the following
behavior. I've been unable to do so. For example, if I load only the
definitions which one would think are associated with this behavior
(four classes and a presentation type), I don't get the problem. I've tried
many other strategies.
I believe that CLIM::ENSURE-PRESENTATION-TYPE is the problem. It crops
up in a number of places below. The CLIM 1.1 release notes indicate that
there used to be a problem of "rehoming" defstruct objects - it appears that in
this implementation, it "rehomes" defclass objects or passes the wrong
parameter to typep.
These are the initial definitions (which work fine in other CLIMs)
of hyperobject and its associated presentation type.
************************from hyperobject.lisp************************************
;;;; Hyperobject Class
(defclass hyperobject
(mediaobjects
hyperobject-links
hyperobject-highlighting)
((user-type :accessor hyperobject-user-type :initarg :user-type)
(author :accessor hyperobject-author :initarg :author)
(name :accessor hyperobject-name :initarg :name)))
;;;; HyperObject Presentation Type
(define-presentation-type hyperobject (aspect) :options (extent frame))
(define-presentation-method presentation-typep (object (type hyperobject))
(and (typep object 'hyperobject)
(aspectp aspect)))
(define-presentation-method presentation-subtypep ((type hyperobject) supertype)
(let ((type-aspect (with-presentation-type-parameters (hyperobject type) aspect))
(super-aspect (with-presentation-type-parameters (hyperobject supertype) aspect)))
(values (eq type-aspect super-aspect) t)))
********************************************************************************
Whether the three classes that hyperobject inherits from have explicit
define-presentation-types for them or not changes none of the behavior.
? (operate-on-system 'hyperobjects2 :compile)
;Loading #4P"HO:rel-2;persistant-store;persistant-store.fasl"...
;Loading #4P"HO:rel-2;lex-tool;clim-extentions.fasl"...
;Loading #4P"HO:rel-2;mediaobjects.fasl"...
;Loading #4P"HO:rel-2;hyperobject-highlighting.fasl"...
;Loading #4P"HO:rel-2;hyperobject-links.fasl"...
;Loading #4P"HO:rel-2;hyperobject-slots.fasl"...
;Loading #4P"HO:rel-2;hyperobject-frame.fasl"...
;Loading #4P"HO:rel-2;hyperobject.fasl"...
;Warning: The direct supertypes of presentation type HYPEROBJECT, (STANDARD-OBJECT),
; do not match the direct superclasses of #<STANDARD-CLASS HYPEROBJECT>,
; (MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING).
; While executing: CLIM::ENSURE-PRESENTATION-TYPE
;Loading #4P"HO:rel-2;lexicon.fasl"...
***********************************************************************
Remainder of load erased from here - no more warnings or errors, though
***********************************************************************
;Loading #4P"HO:rel-2;display-widgets;hyperobject-display-pop-up.fasl"...
NIL
? (in-package ho)
#<Package "HYPEROBJECT">
? (describe (find-class 'hyperobject))
#<STANDARD-CLASS HYPEROBJECT>
Class: #<STANDARD-CLASS STANDARD-CLASS>
Wrapper: #<CCL::CLASS-WRAPPER STANDARD-CLASS #x23DB51>
Instance slots
CCL::NAME: HYPEROBJECT
CCL::PRECEDENCE-LIST: (#<STANDARD-CLASS HYPEROBJECT> #<STANDARD-CLASS MEDIAOBJECTS>
#<STANDARD-CLASS HYPEROBJECT-LINKS>
#<STANDARD-CLASS HYPEROBJECT-HIGHLIGHTING>
#<STANDARD-CLASS STANDARD-OBJECT> #<BUILT-IN-CLASS T>)
CCL::OWN-WRAPPER: NIL
CCL::DIRECT-SUPERCLASSES: (#<STANDARD-CLASS STANDARD-OBJECT>)
CCL::DIRECT-SUBCLASSES: NIL
CCL::DIRECT-METHODS: NIL
CCL::DIRECT-SLOTS: (NIL (USER-TYPE NIL (:USER-TYPE)) (AUTHOR NIL (:AUTHOR))
(NAME NIL (:NAME)))
CCL::SLOTS: (NIL
. #((USER-TYPE NIL (:USER-TYPE)) (AUTHOR NIL (:AUTHOR)) (NAME NIL (:NAME))
(TEXT NIL NIL . TEXT-MEDIAOBJECT)
(LINK-TABLE #<Anonymous Function #x4071CE> NIL)))
CCL::PROTOTYPE: NIL
CCL::DEPENDANTS: NIL
CCL::LOCAL-DEFAULT-INITARGS: NIL
CCL::DEFAULT-INITARGS: NIL
CCL::AUX-INIT-FUNCTIONS-CACHE: NIL
CCL::ALIST: ((CCL::ACCESSOR-METHODS
#<CCL:STANDARD-READER-METHOD HYPEROBJECT-USER-TYPE (HYPEROBJECT)>
#<CCL:STANDARD-WRITER-METHOD (SETF HYPEROBJECT-USER-TYPE) (T HYPEROBJECT)>
#<CCL:STANDARD-READER-METHOD HYPEROBJECT-AUTHOR (HYPEROBJECT)>
#<CCL:STANDARD-WRITER-METHOD (SETF HYPEROBJECT-AUTHOR) (T HYPEROBJECT)>
#<CCL:STANDARD-READER-METHOD HYPEROBJECT-NAME (HYPEROBJECT)>
#<CCL:STANDARD-WRITER-METHOD (SETF HYPEROBJECT-NAME) (T HYPEROBJECT)>))
CCL::MAKE-INSTANCE-INITARGS: NIL
CCL::REINIT-INITARGS: NIL
CCL::REDEFINED-INITARGS: NIL
CCL::CHANGED-INITARGS: NIL
?
******************************************************************************
Note that HYPEROBJECT should inherit from mediaobjects, hyperobject-links, and
hyperobject-highlighting, but it does not after the system has loaded. Hence,
attempts to use hyperobject are ... disappointing.
******************************************************************************
Now we change the definition of the hyperobject presentation type ...
********************************************************************************
(define-presentation-type hyperobject (aspect) :options (extent frame)
:inherit-from '(and mediaobjects hyperobject-links hyperobject-highlighting))
********************************************************************************
... and restart lisp, and reload the system ...
Welcome to Macintosh Common Lisp Version 2.0.1!
?
#P"sartre:SciEd:defsystem.fasl"
?
;Loading #P"sartre:SciEd:hyper-objects:rel-2:system.lisp"...
? (operate-on-system 'hyperobjects2 :compile)
;Loading #4P"HO:rel-2;persistant-store;persistant-store.fasl"...
;Loading #4P"HO:rel-2;lex-tool;clim-extentions.fasl"...
;Loading #4P"HO:rel-2;mediaobjects.fasl"...
;Loading #4P"HO:rel-2;hyperobject-highlighting.fasl"...
;Loading #4P"HO:rel-2;hyperobject-links.fasl"...
;Loading #4P"HO:rel-2;hyperobject-slots.fasl"...
;Loading #4P"HO:rel-2;hyperobject-frame.fasl"...
;Compiling "sartre:SciEd:hyper-objects:rel-2:hyperobject.lisp"...
;Compiler warnings :
; Unused lexical variable ASPECT, in an anonymous lambda form.
; Unused lexical variable FRAME, in an anonymous lambda form.
; Unused lexical variable EXTENT, in an anonymous lambda form.
> Error: FUNCALLABLE-STANDARD-CLASS is not a known type specifier.
> While executing: CCL::BAD-TYPESPEC
> Type Command-. to abort.
See the Restarts menu item for further choices.
The stack trace clearly implicates clim::ensure-presentation-type -
it calls typep with "FUNCALLABLE-STANDARD-CLASS" which appears to be
a bug.
It gets weirder from here on out, but since I can't get cleanly past
this point, let's see if you can find a repairable bug from this.
1 > (ccl:print-call-history)
0 "CCL:PRINT-CALL-HISTORY" 84
... details of irrelevant frames deleted ...
1 "CCL::TOPLEVEL-EVAL" 64
2 "CCL::READ-LOOP" 416
3 "CCL::BREAK-LOOP" 806
4 "CCL::%ERROR" 362
0 : #<Symbol-Function-Locative INTEGERP> ("saved DSAVE0")
1 : #<Symbol-Function-Locative TYPEP> ("saved DSAVE1")
2 : #<STANDARD-CLASS MEDIAOBJECTS> ("saved DSAVE2")
3 : FUNCALLABLE-STANDARD-CLASS ("saved ASAVE0")
4 : #<STANDARD-CLASS MEDIAOBJECTS> ("saved ASAVE1")
5 : (FUNCALLABLE-STANDARD-CLASS)
6 : -45042
7 : NIL
8 : NIL
9 : NIL
5 "CCL::BAD-TYPESPEC" 18
0 : FUNCALLABLE-STANDARD-CLASS (:INHERITED)
6 "TYPEP" 186
0 : #<Symbol-Function-Locative CCL::PUTHASH> ("saved DSAVE0")
1 : #<Symbol-Function-Locative COMPILE-FILE-ENVIRONMENT-P> ("saved DSAVE1")
2 : #<STANDARD-CLASS MEDIAOBJECTS> ("saved DSAVE2")
3 : HYPEROBJECT ("saved ASAVE0")
4 : NIL ("saved ASAVE1")
5 : NIL
7 "CLIM::ENSURE-PRESENTATION-TYPE" 566
0 : HYPEROBJECT ("required")
1 : (ASPECT) ("required")
2 : (EXTENT FRAME) ("required")
3 : (MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING) ("required")
4 : "hyperobject" ("required")
5 : NIL ("required")
6 : NIL ("required")
7 : (NIL NIL NIL) ("required")
8 : (NIL NIL NIL) ("required")
9 : #<CCL::LEXICAL-ENVIRONMENT #x4C1B99> ("optional")
10 : #<Symbol-Function-Locative CCL::ENSURE-VALUE-OF-TYPE> ("saved DSAVE0")
11 : ((MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING) QUOTE (AND MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING)) ("saved DSAVE1")
12 : #<CCL::COMPILE-TIME-CLASS HYPEROBJECT> ("saved DSAVE2")
13 : NIL ("saved ASAVE0")
14 : #<CCL::LEXICAL-ENVIRONMENT #x4C1B99> ("saved ASAVE1")
15 : (MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING)
16 : (#<STANDARD-CLASS MEDIAOBJECTS> #<STANDARD-CLASS HYPEROBJECT-LINKS> #<STANDARD-CLASS HYPEROBJECT-HIGHLIGHTING>)
17 : NIL
18 : NIL
19 : #<CCL::COMPILE-TIME-CLASS HYPEROBJECT>
20 : (#<STANDARD-CLASS MEDIAOBJECTS> #<STANDARD-CLASS HYPEROBJECT-LINKS> #<STANDARD-CLASS HYPEROBJECT-HIGHLIGHTING>)
21 : :|PTYPE HYPEROBJECT::HYPEROBJECT|
22 : (#<STANDARD-CLASS HYPEROBJECT-LINKS> #<STANDARD-CLASS HYPEROBJECT-HIGHLIGHTING>)
23 : "The presentation type ~S is being defined with~@
the class ~S as a direct supertype. This is invalid~@
because ~S cannot be used to create~@
a new subclass of a CLOS class.~
~@[~%Use ~S of ~S first to define the class, then~@
use ~3:*~S to define how that class acts as a presentation type.~]"
24 : HYPEROBJECT
25 : MEDIAOBJECTS
8 "DEFINE-PRESENTATION-TYPE" 592
0 : (DEFINE-PRESENTATION-TYPE HYPEROBJECT (ASPECT) :OPTIONS (EXTENT FRAME) :INHERIT-FROM '(AND MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING)) ("required")
1 : #<CCL::LEXICAL-ENVIRONMENT #x4C1B99> ("required")
2 : #<CCL::LEXICAL-ENVIRONMENT #x4C1B99> ("saved DSAVE0")
3 : :NOT-COMPILE-TIME ("saved DSAVE1")
4 : NIL ("saved DSAVE2")
5 : (DEFINE-PRESENTATION-TYPE HYPEROBJECT (ASPECT) :OPTIONS (EXTENT FRAME) :INHERIT-FROM '(AND MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING)) ("saved ASAVE0")
6 : #<CCL::LEXICAL-ENVIRONMENT #x4C1B99> ("saved ASAVE1")
7 : HYPEROBJECT
8 : (ASPECT)
9 : (EXTENT FRAME)
10 : T
11 : '(AND MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING)
12 : T
13 : "hyperobject"
14 : NIL
15 : NIL
16 : NIL
17 : NIL
18 : NIL
19 : (ASPECT)
20 : (&KEY EXTENT FRAME &ALLOW-OTHER-KEYS)
21 : NIL
22 : '(AND MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING)
23 : (MEDIAOBJECTS HYPEROBJECT-LINKS HYPEROBJECT-HIGHLIGHTING)
24 : (NIL NIL NIL)
25 : (NIL NIL NIL)
**** REMAINDER OF STACK DELETED ****
Main Index |
Thread Index