Xref: utzoo comp.object:3329 comp.lang.eiffel:1535 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!corton!ilog!barbes!davis From: davis@barbes.ilog.fr (Harley Davis) Newsgroups: comp.object,comp.lang.eiffel Subject: Re: Unification: Class=Type=Module Message-ID: Date: 24 Apr 91 12:37:41 GMT References: <1991Apr23.142800.12215@bony1.bony.com> Sender: davis@ilog.fr Organization: ILOG S.A., Gentilly, France Lines: 45 In-reply-to: richieb@bony1.bony.com's message of 23 Apr 91 14:28:00 GMT In article <1991Apr23.142800.12215@bony1.bony.com> richieb@bony1.bony.com (Richard Bielak) writes: One of the things I liked about "Object Oriented Software Construction" by B. Meyer, was the idea that a class is both a type and a module. This idea clears up the confusion as to whether inheritance extends or specializes. When a class is considered to be a type, inheritance specializes the type. The descendent type is type-compatible with fewer things, so it is more specialized. When a class is considered to be a module, inheritance adds more routines and attributes. Since the class can do more things it has been extended. I also like the "cleanness" and simplicity of this idea. I am curious whether other people think about this, and whether such "unification" has any disadvantages. For me, a module is a higher-level structuring tool than a class. A module pulls together a set of classes, functions, methods, and local data which form a coherent design unit. A class is just one of the possible implementation choices for a module; not everything need be tied to a class. This is approach taken by, for example, EuLisp and Le-Lisp version 16. While classes could be identified with modules, I find that in real cases this forces too fine-grained a separation on the implementation. It is difficult to define a module containing an entire class hierarchy with associated operations, all exported as a unit. In this view of the world, the two kinds of inheritance provided by importing modules and subclassing more or less solve the two goals you mention separately - ie, subclassing specializes, and module importation extends. However, I don't see this correspondence as being essential. -- Harley Davis -- ------------------------------------------------------------------------------ nom: Harley Davis ILOG S.A. net: davis@ilog.fr 2 Avenue Gallie'ni, BP 85 tel: (33 1) 46 63 66 66 94253 Gentilly Cedex, France