Oh and of course; the property which is keyed is obviously also
multivalued. So maybe there is a way in which we can enum this to:
singlevalued; multivalued; keyed: keyproperty
Adrian Kuhn wrote:
That makes
if key is set,
it must not be null
key.class must equal self.type
key.multivalued must be false
key.type must be primitive
each value of elem.key must be unique within { elem.key | elem is
in values of self }
and code gen must create an accessor method with the key as argument.
Do we have usecases of that in FAMIX or Magritte?
AA
On 17 Dec 2007, at 11:15 , Toon Verwaest wrote:
And that key.multivalued = false.
I know for a fact that collections don't work as a key in Python for
example :)
Toon Verwaest wrote:
> And for simplicity you might even want to add that the key.type
> must be
> a primitive. (or even a string).
>
> Toon Verwaest wrote:
>
>
>> If "values of self" in the last constraint mean, for example, all
>> instances in the "classes"
>> property of 1 package then yes; that is exactly what I mean.
>>
>> Toon
>>
>> Adrian Kuhn wrote:
>>
>>
>>
>>> Do you mean to add the following property to FM3.Property
>>>
>>> key: FM3.Property
>>>
>>> with the constraint that
>>>
>>> if key is set, it must not be null
>>> if key is set, key.class must equal self.type
>>> if key is set, each value of elem.key must be unique within
>>> { elem.key | elem is in values of self }
>>>
>>> like that?
>>>
>>> AA
>>>
>>> On 17 Dec 2007, at 10:49 , Toon Verwaest wrote:
>>>
>>>
>>>
>>>
>>>
>>>> Wouldn't it be useful to be able to specify properties to be keyed
>>>> when
>>>> they are multivalued? This would allow us to generate dictionary
>>>> related
>>>> code for those keyed elements; and en plus give us a way to
>>>> specify
>>>> that
>>>> one of the properties can not be used twice within a same
>>>> environment.
>>>> Example usage would be the classes property of a fm3.Package which
>>>> would
>>>> be keyed by the property name.
>>>>
>>>> Like this we would be able to do something like:
>>>> aPackage.getFromClassesAt("aName") instead of having to loop
>>>> over the
>>>> classes until we find the right one.
>>>>
>>>> I know that Adrian just stores all fm3specified packages
>>>> +classes into
>>>> one big dictionary... but of course; having this property would
>>>> also
>>>> enable its use one level lower.
>>>>
>>>> Just a thought.
>>>>
>>>> Toon
>>>>
>>>>
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev