From: Vladimir V. Zolotych
Subject: mixins
Date: 
Message-ID: <3AE2DFD6.20F7A273@eurocom.od.ua>
Please give me the idea of mixin classes or
reference where I can read about that concept.
What purpose they stands for ?
In which circumstances they're useful ?

-- 
Vladimir Zolotych                         ······@eurocom.od.ua

From: Mr. Bad
Subject: Re: mixins
Date: 
Message-ID: <87hezgj09v.fsf@priss.bad-people-of-the-future.san-francisco.ca.us>
>>>>> "VVZ" == Vladimir V Zolotych <······@eurocom.od.ua> writes:

    VVZ> Please give me the idea of mixin classes or reference where I
    VVZ> can read about that concept.  What purpose they stands for ?
    VVZ> In which circumstances they're useful ?

PLEASE DO MY HOMEWORK

~Mr. Bad

-- 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Mr. Bad <······@pigdog.org> | Pigdog Journal | http://pigdog.org/ 
 ···········@···@u1AntQcZ81Y4c2tJKd1M87cZvPoQAge/pigdog+journal//
 "Statements like this give the impression that this article was
  written by a madman in a drug induced rage"  -- Ben Franklin
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: Paolo Amoroso
Subject: Re: mixins
Date: 
Message-ID: <mOziOmwPiOqQhxcdvVy8hZr63sDd@4ax.com>
On Sun, 22 Apr 2001 16:42:46 +0300, "Vladimir V. Zolotych"
<······@eurocom.od.ua> wrote:

> Please give me the idea of mixin classes or
> reference where I can read about that concept.

This book discusses some examples:

  "Object-Oriented Programming in Common Lisp
  A Programmer's Guide to CLOS"
  Sonya E. Keene
  Addison-Wesley, 1989


Paolo
-- 
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/
From: Vladimir V. Zolotych
Subject: Re: mixins
Date: 
Message-ID: <3AE532DC.AECD2EAB@eurocom.od.ua>
·······@hotmail.com wrote:
> 
> They are small classes used to provide or override some feature in preexisting
> classes, using multiple inheritance.
[snip]

Understood. As usual things becomes much simpler
when properly explained.

For learners (like me) who find it difficult to get book like 
"PG to CLOS" Sonya E. Keene here is reference on article
in Linux Journal that discusses mixins with Python.
http://www2.linuxjournal.com/lj-issues/issue84/4540.html
(thanks to Paul Foley).

-- 
Vladimir Zolotych                         ······@eurocom.od.ua
From: Vladimir V. Zolotych
Subject: Re: mixins
Date: 
Message-ID: <3AE93BC7.ABABEC03@eurocom.od.ua>
Here is another reference about mixins subject

http://oonumerics.org/tmpw00/eisenecker.html

I've tried to do something similar in CL.

(defclass customer ()
  ((first-name :initarg :first-name
               :accessor customer-first-name)
   (last-name :initarg :last-name
              :accessor customer-last-name)))

(defmethod print-object ((c customer) stream)
  (format stream "~A ~A" (customer-first-name c)
          (customer-last-name c) stream))

(defclass phone-contact ()
  ((phone :initarg :phone :accessor phone-contact-phone)))

(defmethod print-object :after ((pc phone-contact) stream)
           (format stream " ~A" (phone-contact-phone pc)))

(defclass email-contact ()
  ((email :initarg :email :accessor email-contact-email)))

(defmethod print-object :after ((ec email-contact) stream)
           (format stream " ~A" (email-contact-email ec)))

(defclass customer-phone-contact (customer phone-contact))
(defclass customer-phone-email-contact
    (customer phone-contact email-contact))

(make-instance 'customer-phone-contact
               :first-name "Rick"
               :last-name "Racoon"
               :phone "050-998877")
(make-instance 'customer-phone-email-contact
               :first-name "Rick"
               :last-name "Racoon"
               :phone "050-998877"
               :email ·····@deer.com")

-- 
Vladimir Zolotych                         ······@eurocom.od.ua
From: Kent M Pitman
Subject: Re: mixins
Date: 
Message-ID: <sfwbspi8uir.fsf@world.std.com>
"Vladimir V. Zolotych" <······@eurocom.od.ua> writes:

> (defclass customer () [...])
> (defclass phone-contact () [...])
> (defclass email-contact () [...])
> (defclass customer-phone-contact (customer phone-contact))
> (defclass customer-phone-email-contact
>     (customer phone-contact email-contact))

The real power of this is shown when you also do:

(defclass friend () ()) ;i.e., not a subclass of customer, nor vice versa

(defclass friend-phone-contact (friend phone-contact))
(defclass friend-phone-email-contact (friend phone-contact email-contact))
etc.

In most other languages, the first example above (customers only) can be
worked around by subclassing customer appropriately.  But making the same
"nuissance methods" appear on disjoint classes without copying their text
is hard to arrange for.
From: Rainer Joswig
Subject: Re: mixins
Date: 
Message-ID: <joswig-39407B.11484427042001@goliath.news.is-europe.net>
In article <·················@eurocom.od.ua>,
 "Vladimir V. Zolotych" <······@eurocom.od.ua> wrote:

> Here is another reference about mixins subject
> 
> http://oonumerics.org/tmpw00/eisenecker.html

I couldn't stop laughing while reading that page.
In the end I felt very sorry for these guys...
Life is tough. What did they do in an earlier life
to deserve being reborn as a C++ researcher?