Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!johnson From: johnson@m.cs.uiuc.edu Newsgroups: comp.object Subject: Re: Types vs. Classes Message-ID: <77500058@m.cs.uiuc.edu> Date: 28 Sep 90 03:14:00 GMT References: <60700001@inmet> Lines: 46 Nf-ID: #R:inmet:60700001:m.cs.uiuc.edu:77500058:000:2365 Nf-From: m.cs.uiuc.edu!johnson Sep 27 22:14:00 1990 This is a continuation of the discussion of the difference between types and classes in an object-oriented language. First, let me talk about the difference between specification and implementation. A class definition contains a little of both, since an important part of the specification of an object is the set of operations that can be performed on it. Most statically-typed object-oriented languages equate them, e.g. C++, Eiffel, Trellis/Owl. In these language, a subclass inherits both the implementation and the specification of its superclasses. In general, there can be many implementations of a specification and a particular implementation can match many specifications. Moreover, a slight change to a particular implementation can completely change the specification. Thus, it seems to me that it is better to separate specifications and implementations, and not to try to have a single language construct that is used to describe both. Assuming that you buy my argument, which of "type" and "class" should be used to refer to implemenation and specification? This is my interpretation of the original question. What do we mean when we say that a language is statically typed? I could say that this means that programs are type-checked at compile-time, not run-time, but this just begs the question, because what does type-checking mean? What are we checking when we check types? Are we checking implementations or specifications? It seems clear to me that we are checking specifications. If I type-check a Smalltalk expression (x + y) then it means that the value of x is an object that understands the + message and that the type of the argument of the method that is invoked contains the type of y. I think that the preceeding sentence HAS to use the word "type", and that using "class" instead would be very counterintuitive. Thus, it is clear (to me) that "type" means specification and that "class" means implementation. This fits very nicely with the intuition of the Smalltalk community. Everybody knows what I mean when I say that I want to type-check Smalltalk. Some like the idea, some don't like it, but everybody knows that I am requiring the values of variables to have certain properties, and that I have to write down those properties, i.e. specifications. Ralph Johnson -- University of Illinois at Urbana-Champaign