On 10/7/07, Sylvain Joyeux <sylvain.joyeux / polytechnique.org> 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