Summary: strong/weak typing and pointers

Carl Banks imbosol at aerojockey.com
Fri Nov 5 10:15:10 EST 2004


Steven Bethard <steven.bethard at gmail.com> wrote in message news:<mailman.5875.1099517778.5135.python-list at python.org>...
> 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:
[snip]


It seems to me that "weak/strong" description of typing is too
overloaded to be very specific.  Everyone seems to mean something
different by "weak" typing.  Some mean the ability to reinterpret
bits.  Some mean ability to do a lot of implicit conversions.  Some
(not anyone here, of course) mean dynamic typing.  And I'm sure some
mean something else.

I recommend we stop using "weak/strong typing" as a technical term,
and leave it to be a meaningless buzzword for the ignorant peasantry.

Instead, we should define several other scales, with very specific
names.  I'll make some suggestions.  One thing to keep in mind is that
these are, in fact, spectra; many languages will not be one extreme or
the other.

Static/dynamic typing we already know about.

About the ability to reintepret bits: it seems that the essence of
this is that bits can be reinterpreted under different
_circumstances_.  So a good, specific  name for this distinction might
be "manifest/circumstantial typing".  The words are a bit long, yes,
but off-hand I can't think of any shorter words that are specific
enough.  Words like "loose", "flexible", etc. could mean a lot of
things, just as "weak" does.  "Circumstantial" is somewhat more
specific, but still could mean a few different things.  Maybe it
should just be "bit-reinterpretable"?  "Manifest" might not be a good
word, either, since it's kind of discrete in meaning.  Can something
be "less manifest"?  Suggestions welcome, of course.

About the cramming of many different representations into a single
type, abused to the extreme by Perl: we might call this "overloaded
typing".  Two things I don't like about it: first, it has a slightly
negative connotation (I'd prefer that terminology be neutral, which is
another reason I didn't like "strong/weak"), and second, it's not
clear what the opposite aspect should be called.  Perhaps we could
coin some terms such as  "polybasic/oligobasic/monobasic".  (I would
have suggested "polymorphic" but it was taken :).

About the implicit type conversions: this I find the hardest to name. 
The best I can come up with is "coercive/restrictive".  I think we
need a better suggestion.  I really think this label only make sense
for predefined operations, and maybe some functions.  If I write a
function "def a(b): b=int(b); ...", is that coercive in the same
spirit as "a" + 1 in Java?  I would say not.  In fact, I would say
this isn't even a property of the typing.  We should probably say that
a language is a "type-coercive language" rather than that it has
"coercive typing".  Actually, we should say it's something else, cause
I just don't like the term coercive.  Maybe "type-general" vs
"type-specific"?  Seems to vague.  "Type-tolerant" vs "type-picky"?  I
don't know.  Suggestions?

So, to summarize, I recommend we do away with "strong/weak."  We
replace it with four spectra, with some suggested names:

static/dynamic
manifest/circumstantial
monobasic/polybasic
coercive/restrictive*


-- 
CARL BANKS



More information about the Python-list mailing list