[squeak-dev] Abusing #userInterfaceTheme

Stéphane Rollandin lecteur at zogotounga.net
Tue Sep 19 09:43:59 UTC 2017


> 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


More information about the Squeak-dev mailing list