[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Looking for recommendations on how to add a NEW slot option in CLOS.



    Date: Fri, 1 Jun 90 15:20 PDT
    From: BUCKMAN@ALAN.kahuna.decnet.lockheed.com (Eric Buckman)
    To: slug@ALAN.kahuna.decnet.lockheed.com
    
    CLOS has slot options like :documentation, :type, :initarg .....
    
    We'd like to add a slot option (in our case it's :presentation-type).
    
    I think this has something to do with Meta-class definitions, but I'm not really 
    up on how this works.
    
This is quite a reasonable thing to want to do.  Unfortunately there isn't any
documented or supported way to do it, and there isn't even any proposed way to
extend the DEFCLASS macro to add new slot options.  However, you can do it by
making your own variation of the DEFCLASS macro, your own subclasses of
DIRECT-SLOT-DEFINITION and EFFECTIVE-SLOT-DEFINITION, and your own metaclass
with its own methods for DIRECT-SLOT-DEFINITION-CLASS and
EFFECTIVE-SLOT-DEFINITION-CLASS.  Your code will not be portable to other CLOS
implementations, at least not without some changes, and Symbolics will not
guarantee not to change these unsupported things out from under you, but it
will work.  You'll need to look at the source a bit.

I certainly think it ought to be easier than this.  The committee that defined
CLOS shyed away from trying to standardize in this area.