Yea thanks Keith and Lukas. I will play around with these to see what
fits my problem best.
On 9/13/07, Keith Hodges <keith_hodges(a)yahoo.co.uk> wrote:
There are different ways to do this and people
have posted different
solutions to this very problem to the list (check out the archive).
The approach I am using most of the time (you can see it for example
in Pier) is the following one:
Another solution is to use a custom builder, see Magritte-CustomBuilder
(currently in the pieraddons repository).
Use (and hence initialize) your custom builder like so:
MyClass-class-#mgViewActions
^ (MACustomDescriptionBuilder prefix: #mgViewActions) for: self
This will work exactly as a standard builder, so results are cached as
normal. It is faster and more efficient than the normal builder dues to
a selectors lookup optimization (it stops looking at Object class, and
doesnt go any higher, thus avoiding building and searching sets with
thousands of entries)
As you can see the hardest part of this solution is to come up with a
decent method prefix as an alternative to #description!
Having used this for a while, I think it works quite well. However,
unless I can come up with some better naming conventions, I am thinking
of reverting to the method which Lukas describes. i.e. define
MADescription-#beViewAction
^ self propertyAt: #isViewAction put: true
MADescription-isViewAction
^ self propertyAt: #isViewAction ifAbsent: false
and
MyClass-class-#viewActions
^ self description select: [ :each | each | isViewAction ].
best regards
Keith
_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki