Providing lookup environment for descriptions
norbert at hartl.name
Wed Nov 17 20:37:52 MET 2010
On 17.11.2010, at 17:56, Yanni Chiu wrote:
> On 17/11/10 4:34 AM, Norbert Hartl wrote:
>> Well, the question was maybe too unspecific. At first I'm looking for
>> a possibility to create options from the instance side while dealing
>> with components.
> I don't fully understand what you're trying to achieve, but how about you override #description on the instance side. Something like:
> | desc instanceSpecificDesc |
> desc := super description copy. "Copy, else per class cache altered"
> desc add: (instanceSpecificDesc := self descriptionInstanceSpecific).
> instanceSpecificDesc optionsAndLabels: self buildOptionsAndLabels.
> "instanceSpecificDesc options: self buildOptions."
> A variation, to have all the descriptions documented on the class side, is as follows:
> | desc customizedDesc |
> desc := super description copy.
> customizedDesc := desc detect: [:each | each label = 'Customized'].
> customizedDesc options: self customOptions.
> ^ desc
this came to mind as well. I was asking if there is a better idea to achieve the same.
More information about the smallwiki