[Types-sig] Re: Revive the types sig?

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
12 Mar 2001 16:16:56 GMT


Sun, 11 Mar 2001 15:23:07 -0800, Paul Prescod <paulp@ActiveState.com> pis=
ze:

> Even if we took an extreme position and ONLY allowed type annotations
> for basic types like strings, numbers and sequences, Python would
> still be a better language.

I strongly disagree with making it broken-as-designed. A flawed type
system adds too much complexity and yields pain in fighting with its
limitations compared to benefits. We should either do it such that
it really works in most cases, or don't do it at all.

When you pass a string instead of a number to a function, the error
is often caught immediately as soon as the parameter is used. But when
you pass a list and some of its elements don't have the expected type,
the error is more subtle.

For me the ability to specify the type of an argument, but inability to
say anything about elements of a list or tuple, makes the system not
worth adding to a language. Similarly, being able to tell something
only about builtin types or interfaces.

> Java also does not yet have parameterized types and yet it is the
> most rapidly growing statically typed programming language!

Many complaints about static typing result from the assumption that
it must be as poor as in Java, or as complex as in C++.

I suggest taking Haskell, ML or Eiffel as inspiration, not Java.
Java requires type casts to overcome limitations of the static type
system, because of lack of genericity (besides builtin array hack)
and lack of the ability to form conjunctions of interfaces.

Even Java is going to add genericity, and there already exist Java
extensions which do it. Lack of genericity is IMHO the biggest single
flaw in Java's type system.

> Deferred for future versions (or never):
>=20
>  * compile-time type checking
>  * parameterized types
>  * declarations for variables and attributes

I'm afraid that it would give python the worst parts of static and
dynamic typing.

I agree that Python's typing should be optional, but disagree with
the rest of your goals :-(

--=20
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZAST=CAPCZA
QRCZAK