Well, not good. :) Then you would rely on a quite hidden side effect. 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).
Best, Marcel Am 19.09.2017 12:19:17 schrieb Stéphane Rollandin lecteur@zogotounga.net:
Well, on the one hand, we do want to avoid the need for parentheses:
self color: (self themed: #color)
Hmm... if we are sure that all setters are always named from the getters, then this may do the trick:
Object>>getThemed: aSelector ifNone: defaultValue self perform: (aSelector, ':') asSymbol with: ((self themed: aSelector) ifNil: [defaultValue])
Then
self color: (self userInterfaceTheme color ifNil: [Color yellow])
would become:
self getThemed: #color ifNone: Color yellow
The only hurdle I see is the #asSymbol send which may slow things down a little.
Stef