Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!odi!dlw From: dlw@odi.com (Dan Weinreb) Newsgroups: comp.object Subject: Re: Types vs. Classes Message-ID: <1990Sep28.181057.16740@odi.com> Date: 28 Sep 90 18:10:57 GMT References: <60700001@inmet> Reply-To: dlw@odi.com Organization: Object Design, Inc. Lines: 31 In-Reply-To: stt@inmet.inmet.com's message of 25 Sep 90 14:05:00 GMT In article <60700001@inmet> stt@inmet.inmet.com writes: I would like to begin a discussion on the distinction, if any, between "types" and "classes". I'd like to suggest two things about such a discussion. First, be very careful about distinguishing the concept of the "type of a variable" and the concept of the "type of a value". Sometimes (in some contexts to some people), a "type" is something that a variable has, and it serves to constrain the possible values that the value may have. Second, remember that in any serious type system, types do not form a disjoint partition. One type can be a "subtype" of another. Suppose A is a subtype of B. From the value point of view this means that a value of type A is also of type B. From the variable point of view, this means that a variable of type B can hold a value of type A. An implication of this is that usually it is not meaningful to say "the type of value X", since X is usually of more than one type. The relationships between types might not even be strictly hierarchical, which makes it even more complex. There is interesting discussion of all this in the specification of the Common Lisp type system (see Guy Steele's book "Common Lisp", read the chapter on types, look at the functions "typep" and "subtypep"). Common Lisp has an extensive set of runtime features for talking about types, asking questions about types, and so on. It's also very interesting to see how the Common Lisp Object System integrated the notions of "class" and "type".