2009/9/13 Lukas Renggli <
[hidden email]>:
> 2009/9/13 Philippe Marschall <
[hidden email]>:
>> 2009/9/13 Lukas Renggli <
[hidden email]>:
>>> 2009/9/13 Philippe Marschall <
[hidden email]>:
>>>> 2009/9/13 Lukas Renggli <
[hidden email]>:
>>>>>>> I think you should not use #kind to instantiate new objects, but add
>>>>>>> your own property to hold the class you want to instantiate.
>>>>>>
>>>>>> That doesn't solve the problem that kind validation is borken for containers.
>>>>>
>>>>> #kind is used for validation and that should remain like this. The
>>>>> default for containers is Object, so it is a no-op that passes the
>>>>> validation for all objects.
>>>>
>>>> Not if you set kind on a container. And the check is not a no-op at
>>>> all. It checks the class of the memento against the kind which makes
>>>> no sense at all.
>>>
>>> Of course, for what it is designed for it makes perfectly sense.
>>>
>>> As I already said several times, forget about #kind, create your own
>>> property that is not used for validation and do with it whatever you
>>> want.
>>
>> But why is #kind mutable on MADescription when setting it results in
>> failing validation? This is very bad API design. At least it should be
>> pushed down to MAElement description.
>
> Indeed, you are right, but that has nothing to do with the initial problem.
>
> Maybe the MAMemento should rather implement #isKindOf: to dispatch to
> the delegate?
I though about this first too. However now I'm affraid of the possible
things it would break (debuggers, inspectors, ...). Considering that
something as simple as implementing #asString in Object can crash
VisualWorks this makes me very nervous. Maybe specifically handling
mementos or #magritteIsKindOf: are better.
Cheers
Philippe
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki