Adding static typing to Python

Courageous jkraska at san.rr.com
Tue Feb 19 10:40:49 EST 2002


>I don't see anything about strong typing that encourages you to define
>artificial types in this way. 

Speaking of typedef and the C/C++ languages, I've long thought
that in a statically-typed language, the types should never be
aliased, and should always be distinct. For example, the following
shouldn't compile:

typedef float F1;
typedef float F2;

void f (F1 f1);

int main (int argc, char** argv)
{
	F2 f2 = 3.0;

	f ( f2 );
}

That really doesn't sit well with my sensibilities, and frankly,
I believe this is antithetical to what a _statically_ typed
language is all about and intended to accomplish. It's also
internally inconsistent (two structs or classes with the same
fields can't be used as aliased without a hard type cast!), and
that's a bugaboo.

C//




More information about the Python-list mailing list