From: Pat Maddox Date: 2007-10-08T01:12:23+09:00 Subject: Re: The Case for Multiple-Inheritance On 10/7/07, Sylvain Joyeux wrote: > > > Tell me if I'm wrong, but from a type point of view, delegation is > ^^^^^^^^^^^^^^^^^^^^^^^^^ > > What? Half of the Design Patterns book is about how to use > > composition & delegation instead of inheritance. > I don't say that delegation does not exist outside duck-typing. And I never > said that only inheritance is usable from an *engineering* point of view. > > However, the "model(a) == model(b)" comparison does NOT cooperate well with > delegation unless your definition of model is the duck-typing one (for > instance if you define the type as the class of the object). > > Sylvain > > I really really wish you would provide a quick example of what you actually want. I know you're quite busy, but you've managed to find plenty of time for this discussion. Here's something off the top of my head, that allows you to reason about "types" without needing MI. module LinuxApplication; end module VideoApplication; end module WindowsApplication; end class LinuxVideoApplication include LinuxApplication include VideoApplication end class WindowsVideoApplication include WindowsApplication include VideoApplication end def only_linux_video_please(app) raise "Must be a LinuxVideoApplication" unless LinuxApplication === app && VideoApplication === app end