Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!bu.edu!inmet!stt From: stt@inmet.inmet.com Newsgroups: comp.object Subject: Types vs. Classes Message-ID: <60700001@inmet> Date: 25 Sep 90 14:05:00 GMT Lines: 44 Nf-ID: #N:inmet:60700001:000:1771 Nf-From: inmet.inmet.com!stt Sep 25 10:05:00 1990 I would like to begin a discussion on the distinction, if any, between "types" and "classes". There seems to be no consistent distinction made between these two in the OOP literature. I have seen a type considered an implementation of a class, a class as an implementation of a type, the two considered synonyms, etc. Here is a proposed distinction: 1) Each value has a *unique* "type" 2) A value may be a member of one or more "class"es, determined by the type of the value. Essentially, the type structure is considered a "partitioning" of the value space (i.e. types are non-overlapping), whereas the class structure is a taxonomy (i.e. classes overlap and enclose one another). A class comprises a (potentially open-ended) set of types, and a subclass is a subset of a class, comprising a subset of the types in the superclass. In formal terms, it is meaningless to ask "what is the class" of a given value. However, this can be reinterpreted as "what is the smallest class which contains the type" of a given value. ------------------------- I prefer these definitions, because I think they are consistent with the use of the term "type" in strongly-typed non-OOP languages, and consistent with the use of the term "class" in OOP languages. Actually, I think OOP languages tend to be a bit schizophrenic about the term "class" already, since the term is used both for parameters/references which may in fact refer to a value in any subclass of the class, and to identify *the* class of a value (which only makes sense if you use the interpretation suggested above of "smallest class which contains the value"). Comments, flames, etc. welcome... S. Tucker Taft stt@inmet.inmet.com uunet!inmet!stt Intermetrics, Inc. Cambridge, MA 02138