[Cuis-dev] Interesting thoughts about Color
ken.dickey at whidbey.com
ken.dickey at whidbey.com
Sun Apr 28 15:57:05 PDT 2019
> On 4/28/2019 2:20 PM, Phil B via Cuis-dev wrote:
>> I was reading a thread going on over on pharo-dev about Color and
>> thought it was apropos for us. Many of the more commonly used
>> instance methods (#lighter, #darker, #alpha: etc.) are named as if
>> they were accessors or actions which would most naturally be assumed
>> to modify the current color but actually create a new color. If you
>> work with Color to any extent the current behavior is accepted as
>> normal since it is quasi-immutable, but this naming/behavior impedance
>> mismatch does seem pretty obvious when you think about it. Perhaps we
>> should think about modifying these method names to better reflect what
>> they are actually doing? (and perhaps make Color more explicitly
>> immutable?)
This is an analog to numbers.
'3 + 2.' -> 5 , a new, immutable integer. It does not side effect 3
into something else.
As a frequently functional programmer, I agree that being clear about
where state can be changed is key to understanding.
Suggestions?
$0.02,
-KenD
More information about the Cuis-dev
mailing list