does lack of type declarations make Python unsafe?
iastauff at hta.fhz.ch
Tue Jun 17 08:29:27 CEST 2003
In a very strict language, type-safety can really help you avoid
problems. It's one stage of a test. Which language do I talk about? I
don't know. ADA gets closes to this approach, perhaps.
C++ isn't a strict language at all. 1. You have theses nasty pointers to
cast from one edge to the other. 2. You can't overload a function/method
which different only in the return type. Why? Because there are a lot of
implicit ambiguous conversion.
Java isn't better. For example the Interface Transparency: It's a kind
of an enumeration with values 0, 1 and 2. In Java, a wonderful Integer
with 2^32 possibilities. Do we call this compile-time check?
I saw a transparency-like enumeration with another range (don't
remember), starting with value 0 like all other enumerations. These
other constant (value 1) worked with my Image function, but not as I
What do I want to say?
There is an alternative view, the API-User view. In a strong typed
language I don't have to look at the documentation. Based on the type
it's difficult to choose a wrong value. Read thousands of pages
(JavaDoc) needs a lot of time, too.
By the way, Dylan has an interesting idea. Dylan combines typed and
untyped variables (IMO the only real new idea).
Today, there isn't great advantage between so called typed an untyped
language. I'm sure there's a language out there been developed, which
solves our problems. Perhaps there's a time where we have a compiler
which can easily prove for a statically correctness. (Come on Dijkstra
we need more fancy ideas :)
Python gets more and more close to Lisp/Scheme without the lack of
readability. Add a rational type (PEP, I know), add lazy-evaluation -
and we have one of the most powerful languages, without types.
More information about the Python-list