Newsgroups: comp.object,comp.lang.smalltalk,comp.lang.c++,comp.lang.misc
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsfeed.cit.cornell.edu!newsstand.cit.cornell.edu!news.kei.com!newsfeed.internetmci.com!news.sprintlink.net!news.us.world.net!ns2.mainstreet.net!bug.rahul.net!a2i!rahul.net!a2i!news.clark.net!bms88!stuart
From: stuart@bmsi.com (Stuart D. Gathman)
Subject: Re: Types, types: static vs. dynamic -- classification
Organization: Business Management Systems, Inc., Fairfax, VA
Date: Fri, 3 Nov 1995 17:46:07 GMT
Message-ID: <1995Nov3.174607.11088@bmsi.com>
References: <yf391m0qcz3.fsf@sabi.demon.co.uk> <DHEvME.G6K@Cadence.COM> <47apoa$mg1@watnews2.watson.ibm.com>
Lines: 45
Xref: glinda.oz.cs.cmu.edu comp.object:40199 comp.lang.smalltalk:30239 comp.lang.c++:158077 comp.lang.misc:23644

In article <47apoa$mg1@watnews2.watson.ibm.com> you write:

>I contend that Smalltalk HAS NO CONCEPT OF TYPE.

I  read  your article.  Yes, Smalltalk *variables* (the names for
references to objects) have no type as  you  contend.    However,
the   ob- jects  themselves certainly do have a well defined time
which you specify via 'new'.

In Smalltalk, variable names are names of references to the actu-
al  values  -  hence Smalltalk is said to have 'reference' seman-
tics.  There  can  be any number of references to the same value.
C  and  Pascal, OTOH, have names for the actual  values  ('value'
seman- tics)   -   hence   the  names have a type.   C  &  Pascal
also have names for references or pointers that also have a type.
However, this  is  *not* the type of the value.  In  C++,  it  is
the  type  of  the  protocol which the value  is  known  to  obey
(i.e.  a  base class).   Since the same  hierarchy  is  used  for
both  type and pro- tocol, C++ can be confusing if you don't keep
them  straight  in your head.

Enhanced  versions  of  Smalltalk  also  have "protocol checking"
which assigns a protocol to its  reference  variables.   This  is
*not*   the actual type of the value referred to - just a promise
as to which messages will not result in  "does  not  understand".
The   protocol hierarchy has no relation to the inheritance hier-
archy.

When using an unenhanced compiler, Smalltalk programmer typically
use variables names suggesting the protocol, such  as  "aString".
Again,  this  does  not  mean that an actual String object is re-
quired, just that the object must do String things.

In Smalltalk, the type of an object is specified at run-time via
the 'new' message.  Only the protocol is specified at compile time,
and only if the compiler supports protocols.  Thus, Smalltalk
is often said to be 'run-time typed'.

C++ supports a mixture of compile-time (both value and protocol) 
and run-time typing.
-- 
Stuart D. Gathman	<stuart@bmsi.com>
     			<..!uunet!bms88!stuart>
    			Business Management Systems Inc.
   			Phone: 703 591-0911 Fax: 703 591-6154
