Summary: strong/weak typing and pointers

Jeff Shannon jeff at ccvcorp.com
Wed Nov 3 17:18:43 EST 2004


Steven Bethard wrote:

>Gabriel Zachmann writes:
>  
>
>>would sort of a summary of this thread be of any help?
>>    
>>
>
>Here's a first stab at one:
>
>[...]
>(2) A language is "weakly-typed" if it has a large number of implicit coercions.
>
>[...]
>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.
>  
>

A case could be made that this "problem" isn't really valid if you look 
at "implicit coercions" in the right way.

I'd argue that a programmer-overloaded operation providing coercion is 
not _implicit_ in the same sense that language-default coercion is.  
Admittedly, the coercion may not be immediately evident at the point of 
use, but one can still find the explicitly-coercing code somewhere 
inside the application (and/or included libraries).  In contrast, the 
coercions that happen in Perl, PHP, etc., are not explicitly stated 
*anywhere* in the application.  The difference between these two 
scenarios is, at least in my mind, very distinct and (at least as far as 
language philosophy) very profound -- it's one of *permitting* 
semi-implicit coercions (if the programmer *really* wants them) versus 
one of *mandating* implicit coercions whether the programmer wants them 
or not.

In other words, definition 2 should read that a language can be 
considered "weakly typed" if the *language definition* specifies a large 
number of implicit coercions.

Jeff Shannon
Technician/Programmer
Credit International




More information about the Python-list mailing list