strong/weak typing and pointers

Scott David Daniels Scott.Daniels at Acm.Org
Tue Nov 2 16:22:00 CET 2004


Gabriel Zachmann wrote:
> I am just trying to come up with the best possible definition of "weak and
> strong typing" ( "best" in the sense of completeness and objectiveness).
> I've read up quite a bit about strong/weak typing, and static and dynamic
> typing, and it seems to me that, while static/dynamic typing is a pretty
> well-defined concept, the definition of strong/weak typing is not so
> clear-cut.
How about something like this:

Strong typing respects data as invariant.  There is no way to "sneak
around" a data type and "tweak" its representation.  The reason C is
weakly typed is that you can easily get to the bits in a float (for
example), rather than always having to deal with a float with float
operations.

Strong types provide strong protection for data types as their
abstraction; weak types allow you to operate on data "behind the
wall of abstraction".  A Smalltalk programmer would say that
Python is more weakly typed than Smalltalk for user-defined types.

-Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list