From: Vladimir Zolotykh
Subject: MOP question: DEFCLASS options handling
Date: 
Message-ID: <3DAD6FD2.38C0D9D3@eurocom.od.ua>
Suppose I have simple metaclass like the follwing

(defclass pg-metaclass (standard-class)
  (#|..............|#
   (table :initarg :table :reader pg-metaclass-table)))

Being initialized with 

(defclass compound-order (pg-object)
  (#|...............|#)

  (:table "compound_orders")
  (:metaclass pg-metaclass))

the application's class has TABLE slot value ("compound_orders")
[list]. Actually I needed only "compound_orders", e.g. the first item
of the list. I could achieve that in proper reader method.  Do you
think this is agreeable with MOP good style? If not, could you suggest
the better way for doing that?

Thanks in advance

-- 
Vladimir Zolotykh

From: Kenny Tilton
Subject: Re: MOP question: DEFCLASS options handling
Date: 
Message-ID: <jyfr9.9342$gB.2794109@twister.nyc.rr.com>
Vladimir Zolotykh wrote in message <·················@eurocom.od.ua>...
>Suppose I have simple metaclass like the follwing
>
>(defclass pg-metaclass (standard-class)
>  (#|..............|#
>   (table :initarg :table :reader pg-metaclass-table)))
>
>Being initialized with
>
>(defclass compound-order (pg-object)
>  (#|...............|#)
>
>  (:table "compound_orders")
>  (:metaclass pg-metaclass))
>
>the application's class has TABLE slot value ("compound_orders")
>[list]. Actually I needed only "compound_orders", e.g. the first item
>of the list. I could achieve that in proper reader method.  Do you
>think this is agreeable with MOP good style? If not, could you suggest
>the better way for doing that?

with:

(defclass compound-order (pg-object)
  (#|...............|#)

  (:table "compound_orders" "aka_comp_orders" "aka_cp_orders")
  (:metaclass pg-metaclass))

...you can see all three strings. So that is why you got a list. But your
intent is to have just one.

I would go with your idea of the reader method.

If you really need the slot per se to be occupied by the one string
(apparently not the case), you could intervene via an :around method on
initialize-instance. That would give you a chance also to validate that the
defclass author did not supply more than one string.

kenny
clinisys
From: Martin Simmons
Subject: Re: MOP question: DEFCLASS options handling
Date: 
Message-ID: <3dae974e$0$1291$ed9e5944@reading.news.pipex.net>
"Kenny Tilton" <·······@nyc.rr.com> wrote in message
··························@twister.nyc.rr.com...
>
> Vladimir Zolotykh wrote in message <·················@eurocom.od.ua>...
> >Suppose I have simple metaclass like the follwing
> >
> >(defclass pg-metaclass (standard-class)
> >  (#|..............|#
> >   (table :initarg :table :reader pg-metaclass-table)))
> >
> >Being initialized with
> >
> >(defclass compound-order (pg-object)
> >  (#|...............|#)
> >
> >  (:table "compound_orders")
> >  (:metaclass pg-metaclass))
> >
> >the application's class has TABLE slot value ("compound_orders")
> >[list]. Actually I needed only "compound_orders", e.g. the first item
> >of the list. I could achieve that in proper reader method.  Do you
> >think this is agreeable with MOP good style? If not, could you suggest
> >the better way for doing that?
>
> with:
>
> (defclass compound-order (pg-object)
>   (#|...............|#)
>
>   (:table "compound_orders" "aka_comp_orders" "aka_cp_orders")
>   (:metaclass pg-metaclass))
>
> ...you can see all three strings. So that is why you got a list. But your
> intent is to have just one.

This is true, but I think it is a misfeature of some MOPs to provide such
nonesenical default option processing.
--
Martin Simmons, Xanalys Software Tools
······@xanalys.com
rot13 to reply