From: Tayssir John Gabbour
Subject: MOP design problem with multiple slot options?
Date: 
Message-ID: <1142598766.674316.305280@u72g2000cwu.googlegroups.com>
I'm wondering whether this is a MOP design flaw:

(defclass foo-1 ()
  ((slot-1 :new-slot-option (list :quux :bar))))

(defclass foo-2 ()
  ((slot-1 :new-slot-option :bar
           :new-slot-option :quux)))

In both cases, initialize-instance tells me that :new-slot-option is
(LIST :QUUX :BAR).

Is that a good idea? That can lead to ambiguities.


( http://www.lisp.org/mop/concepts.html#slot-definitions claims: "All
other slot options appear as the values of properties with the same
name as the slot option. Note that this includes not only the remaining
standard slot options (:allocation and :type), but also any other
options and values appearing in the slot specification. If one of these
slot options appears more than once, the value of the property will be
a list of the specified values.")


Thanks,
Tayssir
From: Ken Tilton
Subject: Re: MOP design problem with multiple slot options?
Date: 
Message-ID: <4DBSf.90$KY4.43@fe08.lga>
Tayssir John Gabbour wrote:
> I'm wondering whether this is a MOP design flaw:
> 
> (defclass foo-1 ()
>   ((slot-1 :new-slot-option (list :quux :bar))))
> 
> (defclass foo-2 ()
>   ((slot-1 :new-slot-option :bar
>            :new-slot-option :quux)))
> 
> In both cases, initialize-instance tells me that :new-slot-option is
> (LIST :QUUX :BAR).
> 
> Is that a good idea? That can lead to ambiguities.

As the developer of :new-slot-option (I think in 
compute-effective-slot-definition, but it has been five years since I 
mopped) you get to resolve the ambiguity if that is how you see it. But 
consider the example of the standard slot option :initarg. Here you want 
the list, because I should be able to specify any of the values offered. 
The confusion (I agree) lies in the mind of the user who is specifying 
multiple initargs for the same slot. :)

kt

-- 
Cells: http://common-lisp.net/project/cells/

"And I will know my song well before I start singing."  - Bob Dylan