[Openmcl-devel] MOP initialize-instance question

Cyrus Harmon ch-openmcl at bobobeach.com
Mon Sep 13 09:19:10 UTC 2004


On Sep 13, 2004, at 1:57 AM, rm at fabula.de wrote:

> On Mon, Sep 13, 2004 at 01:25:26AM -0700, Cyrus Harmon wrote:
>> So I'm trying to make my own metaclasses and I have a class that has a
>> mix of some "special" slots and some standard slots. I can get
>> slot-value-using-class and setf s-v-u-c to work properly, but I can't
>> figure out how to hijack the initargs stuff so the MOP code Does What 
>> I
>> Mean. It would be nice if there were an initialize-slot that got 
>> called
>> by initialize-instance (or %shared-initialize).
>
> Initialize _what_ instance - that of your metaclass or that of classes
> having your metaclass as the metaclass?

Classes having my metaclass as the metaclass.

> For the first there is compute-effective-slot-definition where you get
> a chance to initialize your slots ....

Right. This seems to work well.

>> But there doesn't seem
>> to be. Any suggestions for how I can get slot-specific (or even
>> direct-slot-definition-specific) behavior so I can use the built-in
>> stuff for "normal" slots and do my own work to figure out what the
>> values (and where they should go are) for my non-normal slots?
>
> Hmm, again, this depends on the above question, but can't you just
> write a defmethod for 'initialize-instance :after' specialized on
> your direct or effective slot?

Hmmm... specialized on the slot? I've got an initialize-instance 
specialized on the metaclass, and another on the class (sort of -- 
really a class that the metaclass sticks in as a parent). I hadn't 
thought of trying this on the slot, but I don't think that will work as 
%shared-initialize is going to allocate storage for the slot. I think I 
want a way finer control over the internals of the initialize-instance 
process and I don't have them...

>> Is there a better way to skin this cat?
>
> Oh, this cat seems to have many skins ;-)

Yes, I'm up to my ears in feline pelts.

Cyrus




More information about the Openmcl-devel mailing list