I think the accessor is an ideal object to identify descriptions,
because it uniquely identifies a description.
Instead of duplicating the accessor you could ask the description for
its accessor:
accessor := MBBooking descriptionEventStatus accessor.
MBBooking description detect: [ :each | each accessor = accessor ]
If you do not depend on the extension mechanisms of descriptions, you
could also direct call
MBBooking descriptionEventStatus
to get the description. A bit ugly I agree, we should refactor the
creation of descriptions so that also individual descriptions can be
cheaply retrieved.
Lukas
On 18 September 2011 14:05, Jan van de Sandt <jvdsandt(a)gmail.com> wrote:
Hi,
In Magritte a MAContainer has a collection of MAElementDescription objects
called children. Often I would like to access a child using it's name.
Currently a MADescription doesn't have a name property. Most of the times it
does have a label and an accessor so I can find a child like this:
| accessor |
accessor := #eventStatus asAccessor.
MBBooking description detect: [ :each | each accessor = accessor ]
or
MBBooking description detect: [ :each | each label = 'Event status' ]
I don't like these options for identifying a child description because they
depend on properties that are used for other things. I am thinking about
adding an some kind of 'name' property to the description hierarchy. I am
curious how others have handled this issue.
Jan.
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
--
Lukas Renggli
www.lukas-renggli.ch