Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!newsfeed.internetmci.com!in2.uu.net!spool.mu.edu!munnari.OZ.AU!news.hawaii.edu!phinely
From: phinely@Hawaii.Edu (Peter Hinely)
Subject: Re: Will Java kill C++? (definition of strong typing)
X-Nntp-Posting-Host: uhunix4.its.hawaii.edu
Message-ID: <Dpyro4.8o9@news.hawaii.edu>
Sender: news@news.hawaii.edu
Organization: University of Hawaii
References: <31682FFE.2781E494@bbn.com> <dbell-1 <3171810F.2E2@funsys.se> <4l0f6o$sec@nkosi.well.com>
Date: Tue, 16 Apr 1996 16:40:51 GMT
Lines: 43
Xref: glinda.oz.cs.cmu.edu comp.lang.java:40894 comp.lang.c++:185045 comp.lang.smalltalk:37415

In article <4l0f6o$sec@nkosi.well.com>,  <sparker@well.com> wrote:
>
>The pertinent distinctions would seem to be:
>
>*How* typing takes place - the static/dynamic distinction.
>*When* typing takes place - the early/late distinction.
>*Breadth* of typing - how wide/narrow are the types handled
>by the language? For example C and COBOL have only a handful
>of types. Languages such as C++, ST, and Java, whose class
>mechanism allows user-definition of types can permit finer
>distinction of types. Eg in C a string can represent both an
>address or a set of modem initialization instructions, and this
>is the only way to implement them. In an OO language, different
>classes can represent the two. I would judge the latter set of
>languages to have a 'narrower' typing mechanism than the former.
>>

Some languages have typing systems that don't fit in the conventional molds.

For example in Dylan:

  define variable *my-variable* = 0;

binds *my-variable* to the integer object 0.

The binding of *my-variable* can be later be changed to refer to an 
object of any class (i.e. floating point numbers, strings, collections, even 
classes and functions).

You can however specify type information for variables that you declare, 
which limits their type:

  define variable *my-variable* :: <integer> = 0;

In this case, the binding of *my-variable* can be only be changed to refer 
to another integer.


This type system allows Dylan programs to be prototyped rapidly without
type information.  Type information can later be added in, which the
compiler can use to optimize the program better, giving you the best of 
both worlds:  rapid development and good performance in your final program.

