Hello Jakub, Kenny Jakub beat me into making the PRINT-OBJECT method more robust. Nevertheless: my problem - whatever it is - has disappeared. I am not all that comfortable leaving behind me a problem (in SBCL or CELLS) that I don't understand. But at least this solution of Jakub's cannot possible have any negative side effects.
I still don't have a clue what the basic problem is - I have spent a few hours today trying to get the modified PRINT-OBJECT method print something or enter the debugger - no such luck. I never see the output of the code snippet "(format s "UNINITIALIZED-~a" (type-of self)". It seems that when the method is recoded to be more robust, it stops being invoked. You confused? I am!
At any rate, thanks for the support, I can now get on with my project. Kenny, you might wish to enter this small modification in the main Cells CVS source.
Jakub, you write "Perhaps I do not understand your problem". I have been amiss explaining the manifestation of the problem. It comes here: with the origical Cells code, the first time I access - SETF or not - the PROTOTYPE slot af a newly defined PCL-CLASS - if the class in question is a model - the access fails. The access should trigger an allocation of the prototype object. The failure - whatever it is - is shadowed by the problem with PRINT-OBJECT. But the result is, that the PROTOTYPE slot in the PCL-CLASS object representing the MODEL class - is no longer NIL, it is unbound.
But never mind, don't worry about this. Jakub's fix pushes this problem out of the real world, at least for me.
best regards --peder chr.
On Thursday 21 May 2009, you wrote:
Hello,
On Thu, May 21, 2009 at 1:08 PM, Peder Chr. Nørgaard pcn@pogt.dk wrote:
Modifying the content of the prototype object of a class - which is what your proposal does - is too likely to have some devastating side effects - now .MD-STATE and .MD-NAME are no longer NIL by default, as specified in the definition of MODEL, they are :PROTOTYPE...
But in the prototype object they are not NIL anyway, but unbound, which is the problem. As far as I can tell the prototype object is used mostly for method computation.
In any case changing relevant print-object method in family.lisp to [I pushed it to my mostly cosmetic fork of cells at http://github.com/Ramarren/cells/commit/b808dbd7cceea5573f09a1e02abbfb08e20 478c7 ]
(defmethod print-object ((self model) s) #+shhh (format s "~a" (type-of self)) (if (and (slot-boundp self '.md-state) (slot-boundp self '.md-name)) (format s "~a~a" (if (mdead self) "DEAD!" "") (or (md-name self) (type-of self))) (format s "UNINITIALIZED-~a" (type-of self))))
seems to work as well. Perhaps I do not understand your problem, what I do is this (with the change above):
CL-USER> (defmodel my-model (model) ((my-class-slot :cell nil :ALLOCATION :CLASS))) #<STANDARD-CLASS MY-MODEL> CL-USER> (sb-mop:finalize-inheritance (find-class 'my-model)) NIL CL-USER> (setf (slot-value (sb-mop:class-prototype (FIND-CLASS 'my-model)) 'my-class-slot) 'a-value) A-VALUE CL-USER> (slot-value (sb-mop:class-prototype (find-class 'my-model)) 'my-class-slot) A-VALUE
Regards, Jakub Higersberger