[Cuis-dev] Interesting thoughts about Color
ken.dickey at whidbey.com
ken.dickey at whidbey.com
Sun Apr 28 19:05:51 PDT 2019
On 2019-04-28 17:57, Phil B wrote:
> Ken,
>
> I'm not following your thinking here. What other implementations of
> things like #darker are you thinking of and how would renaming break
> encapsulation?
>
> As an example, let's say we had Form implement #darker which darkened
> the image and Color where #darker returns a new, darker color. I'd see
> that as semantic overloading, not polymorphism. And in the event we
> actually wanted the Form implementation to return a new, darkened Form,
> how would calling it #asDarkerForm break encapsulation? To me, that's
> just making it clear that you are not darkening the existing image but
> rather creating a new one... I still have no idea what's going on
> inside the object, only what I expect it to do/return.
I tend to think of immutable, functional data structures. So I don't
expect 'foo darker' to return a mutable object.
How would 'foo asDarker' help me?
Why bother to go through a lot of working code and change #darker to
#asDarker to distinguish cases where uses of #darker returns a mutable
object?
Where is the semantic distinction helpful?
-KenD
More information about the Cuis-dev
mailing list