« Return to Thread: Real (trivial) mixins

Re: Real (trivial) mixins

by Samuel A. Falvo II :: Rate this Message:

Reply to Author | View in Thread

On Wed, Apr 15, 2009 at 9:55 AM, Guy Hulbert <gwhulbert@...> wrote:
> Hmm.. can you explain a bit more -- *why* you would want to do this.

Isolation.  Use this method when/if you anticipate your parent(s)
might change in the future, but you want to preserve their current
behavior as a snapshot now.

> It's useful to know that this is how Io behaves but it's not obvious to
> me why it's useful.  There must be some "real world" example.

I would suggest studying CLU or Sather and how they use mixins for
program composition.  That will explain things far more effectively
than executive and potentially contrived examples here.

> Also, could you easily change the mixin design so that the change to
> Math would automatically propagate to Foo?

Simply clone Math, but do not invoke asMixin.

--
Samuel A. Falvo II

 « Return to Thread: Real (trivial) mixins