Newsgroups: comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!cpk-news-hub1.bbnplanet.com!worldnet.att.net!howland.erols.net!cs.utexas.edu!chi-news.cic.net!ftpbox!mothost.mot.com!schbbs!news
From: shang@corp.mot.com (David L. Shang)
Subject: Defintion, again, was Re: Static vs. Dynamic typing again
Reply-To: shang@corp.mot.com
Organization: MOTOROLA 
Date: Thu, 30 Jan 1997 15:37:58 GMT
Message-ID: <1997Jan30.153758.1713@schbbs.mot.com>
References: <5covaj$l0@boursy.news.erols.com>
Sender: news@schbbs.mot.com (SCHBBS News Account)
Nntp-Posting-Host: 129.188.128.126
Lines: 96
Xref: glinda.oz.cs.cmu.edu comp.lang.smalltalk:50480 comp.lang.eiffel:17999 comp.lang.ada:56872 comp.object:60591

In article <5covaj$l0@boursy.news.erols.com> feldmand@erols.com (Damon Feldman)  
writes:
> 
> >I think it's a bit misleading to say that Smalltalk is dynamically typed
>
> Statically typed means that types are *determined* at compile time.
> Dynamically typed means types are *determined* at runtime.
> 
> Static type *checking* means checking done at compile time.
> Dynamic type *checking* means checking at run time, I suppose.
> 

I would like to make more definitions here.

Dynamically Typed (con: statically typed). An argument (variable,
 reference, or formal parameter) is dynamically typed if the type
 of the object to which the argument can be bound cannot be
 determined statically (at compile or link time). Examples of
 dynamically typed arguments are:
  Untyped without static type inference: the type is not given before 
    run-time. It can be bound to an object of any type at run-time.
    This is an extreme case of the dynamically typed. The example is
    a SmallTalk variable.
    Note that a variable in ML is also untyped, but the exact type of
    its bound object is inferred (guaranteed!) before run-time.
    Therefore, an ML variable, though untyped at the time of
    declaration, but typed at the time before running. It is not
    dynamically typed by this definition.
  Polymorphically typed: the type is given at the time the argument
    is declared. It can be bound to an object of any subtype of the
    given type at run-time. A Java's variable (non-primitive) falls
    into this case. 
  Tagged Union: a set of possible types are given at the time the
    argument is declared. It can be bound to one of the given types
    at run-time.

Dynamic Typing (con: static typing). A type system is a dynamic
 typing system if new types can be defined/created at run-time.
 CLOS and Dylan support dynamic typing while C++, Java, Eiffel,
 and Ada95 are static typing languages. In a dynamic typing
 system, the class hierarchy can be dynamically expanded by
 adding new subclasses at the time the programming is running.
 But the class hierarchy is fixed at runtime in a static typing
 system.

Dynamic Type (con: static type). A type is a dynamic type if its
 definition can be changed after its creation. Therefore, we can
 add/delete methods or slots in a dynamic type at run-time.
 A static type is fixed since it is created. A simulation of dynamic
 type by dynamic typing system can be done by considering a new type
 is created whenever the existing type changes.  

Dynamic Type Checking (con: static type checking): checking the
 type of a dynamically typed argument at run-time.

Dynamic Type Safe: All type errors, if cannot be not prevented from
 happening at compile time or link time, should be detected at
 run-time.

   [ A type error is such an incorrect binding of
     an object to a name that the type of the object does not
     conform to the declared type of the name.
   ]

Static Type Safe (stronger): All type errors can be prevented
 from happening before run-time.

Strong Type Safe (further stronger): All type errors can be
 prevented from happening before the software is released. This
 is a new definition. By this definition, C++ templates is
 static type safe but not strong type safe. C++ templates are
 released to clients in the form of source code. The type error
 is detected at the time it is used by clients, not at the
 time the template is designed or developed.

My comments:

Dynamic type checking is not only for dynamic type safe. It
can be used for error prevention and produce a strong type
safe language!

For how and why, you may refer to my language compariosn
document:

	Transframe, Java & C++: A Critical Comparison
	http://www.transframe.com,
	at Research/TransframeLanguage page

David Shang


  

  


