Summary: strong/weak typing and pointers

Steven Bethard steven.bethard at gmail.com
Wed Nov 3 22:36:11 CET 2004


Gabriel Zachmann writes:
>
> would sort of a summary of this thread be of any help?

Here's a first stab at one:


In summary, there are basically three interpretations of "weak-typing" discussed
in this thread:

(1)  A language is "weakly-typed" if it allows code to take a block of memory
that was originally defined as one type and reinterpret the bits of this block
as another type.

(2) A language is "weakly-typed" if it has a large number of implicit coercions.

(3) A language is "weakly-typed" if it often treats objects of one type as other
types.


Some points and problems addressed with each of these definitions:

Definition 1 is the definition most commonly used in Programming Languages
literature, and allows a language to be called "weakly-typed" based only on the
language definition.  However, for all intents and purposes, it is only
applicable to statically typed languages; no one on the list could come up with
a dyamically typed language that allowed bit-reinterpretation.

Definition 2 seemed to be the definition most commonly used on the list, most
likely because it is actually applicable to a dynamically typed language like
Python.  It has the problem that in a language that supports operator
overloading (like Python), programmers can make their language more
"weakly-typed" by simply providing additional coercions, thus whether or not a
language is called "weakly-typed" depends both on the language definition and
any code written in the language.

Definition 3 was an attempt to unify the first two definitions into a single
definition by describing both coercion and bit-reinterpretation as treating
"objects of one type as other types".  This definition has the advantage of
better coverage, but has all the disadvantages of Definition 2.  It is also
unclear as to how weak a "weakly-typed" language is if it both allows
bit-reinterpretation and has a large number of implicit coercions.  (For
example, is a language that allows bit-reinterpretation and only a few implicit
coercions more or less "weakly-typed" than a language that doesn't allow
bit-reinterpretation, but has a large number of implicit coercions?)


I'll leave it to others to classify the various languages by these definitions.
;)

Steve





More information about the Python-list mailing list