[mercury-users] this appears to be a mixin

Peter Schachte schachte at cs.mu.OZ.AU
Wed Jul 11 11:10:50 AEST 2001


On Wed, Jul 11, 2001 at 11:41:44AM +1200, Richard O'Keefe wrote:
> What is a mixin class?  The term comes from the old "Flavors"
> system for Lisp, and refers to American ice-cream vending
> practices.

Actually, it was just one ice cream vendor in Cambridge frequented by MIT
people.  I believe it was called Steve's.  They had vanilla ice cream and
racks and racks of things you could add to it (mixins) like various kinds of
lollies, candy bars, syrups, cookies, etc.  The mixins and ice cream would
go into a machine to be crushed and mixed and then served.  This is why the
flavors system calls the default base class "vanilla."  It's an interesting
case of design by metaphor.

>  A mixin is a class that adds features (in this
> it is very very different from a Java interface, which CAN'T
> provide implementations, the whole point of a mixin is to
> do just that) but cannot stand by itself.  A concrete class
> must have at least one ancestor that is not a mixin class.

A good example of a mixin would be something that would count the instances
of the class.  It's something that would make sense to do for any class, and
it doesn't rely on any particular methods of the class except the
constructor.  Flavors has a sophisticated system for combining constructors.

This is an interesting example because, as far as I can see, there's no way
to code such an abstraction in Mercury.

-- 
Peter Schachte <schachte at cs.mu.OZ.AU>  Basically, Clinton's approach to
http://www.cs.mu.oz.au/~schachte/      America is, "Vote for me, I'm not
Phone:  +61 3 8344 9166                Newt Gingrich."
Fax:    +61 3 9348 1184                    -- Ralph Nader 
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list