[squeak-dev] Abusing #userInterfaceTheme
lecteur at zogotounga.net
Tue Sep 19 13:32:25 UTC 2017
> You do not know in advance how the object stored in a theme will be used
> by the client. It is not always a simple instVar write.
> Consider this example:
> slider borderColor: ((self userInterfaceTheme borderColorModifier
> ifNil: [ [:c | c adjustBrightness: -0.3] ]) value: aColor).
This can easily be folded back into the getter/setter pattern:
self borderColor: (aBlock value: self borderColor)
self borderColor: aColor.
self getThemed: #borderColorModifier
ifNone: [:c | c adjustBrightness: -0.3]
So I guess it's down to a design choice. I would vote for consistency of
pattern, and having everything written in getter/setter pairs.
More information about the Squeak-dev