[squeak-dev] Abusing #userInterfaceTheme
Marcel Taeumel
marcel.taeumel at hpi.de
Tue Sep 19 09:51:06 UTC 2017
Well, on the one hand, we do want to avoid the need for parentheses:
self color: (self themed: #color)
...which we did not manage because of the default values:
self color: (self userInterfaceTheme color ifNil: [Color yellow]).
So, that option is still on the table, Chris, right?
Just for the record: There was an idea to fully get rid of the parentheses by falling back to an object's message:
Tree >> defaultLeafColor
^ Color green
Tree >> initialize
self leafColor: self userInterfaceTheme leafColor
But the current tools in Squeak would make editing all related artifacts a hassle.
Best,
Marcel
Am 19.09.2017 11:43:56 schrieb Stéphane Rollandin <lecteur at zogotounga.net>:
> First quick thought: What about renaming #userInterfaceTheme to
> #scopedInTheme or something similar that does not look like an accessor?
It is certainly better.
Now, since #userInterfaceTheme must always be followed by another
selector (else bad things may happen), it seems to me that it should not
be a unary method, but a binary one.
So what about
Object>>themed: aSelector
^ self userInterfaceTheme perform: aSelector
... which of course could be simplified so what we get rid of
#userInterfaceTheme altogether (and actually of the full scoping mechanism):
Object>>themed: aSelector
^ UserInterfaceTheme current get: self class -> aSelector
The usage would be
BalloonMorph new themed: #color
where we now have
BalloonMorph new userInterfaceTheme color
I understand the latest looks better, but I do not think it is worth all
the DNU shenanigans it requires the end user to be aware of...
Best,
Stef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170919/e59ab554/attachment-0001.html>
More information about the Squeak-dev
mailing list
|