"no variable or argument declarations are necessary."

Steve Holden steve at holdenweb.com
Fri Oct 7 10:45:08 CEST 2005


Paul Rubin wrote:
> Steve Holden <steve at holdenweb.com> writes:
> 
>>In other words, you want Python to be strongly-typed, but sometimes
>>you want to allow a reference to be to any object whatsoever. In which
>>case you can't possibly do any sensible type-checking on it, so this
>>new Python+ or whatever you want to call it will suffer from the same
>>shortcomings that C++ and java do, which is to say type checking can't
>>possibly do anything useful when the acceptable type of a reference is
>>specified as ANY.
> 
> 
> Let's see if I understand what you're saying:
> 
>     C and Java: you get useful type checking except when you declare
>     a reference as type ANY.  This is a shortcoming compared to:
> 
>     Python: where you get no useful type checking at all.
> 
> That is not very convincing logic.

As we say in Yorkshire, "There's none as thick as them that wants to 
be". Let's try to get this in context.

Antoon:
> Suppose we have a typesystem which has the type ANY, which would mean
> such an object could be any type. You could then have homogenous lists
> in the sense that all elements should be of the same declared type and
> at the same time mix all kind of type in a particular list, just
> as python does.

Diez:
> The you have JAVA Object or C void*. Which cause all kinds of runtime 
> troubles.... because they essentially circumvene the typechecking!

Antoon:
> Why do you call this a JAVA Object or C void*? Why don't you call
> it a PYTHON object. It is this kind of reaction that IMO tells most
> opponents can't think outside the typesystems they have already
> seen and project the problems with those type systems on what
> would happen with python should it acquire a type system.

Me:
> Diez' intention seemed fairly clear 
> to me: he is pointing out that strongly-typed systems invariably fall 
> back on generic declarations when they want to allow objects of any type 
> (which, it seems to me, is what you were proposing as well).

You:
>     C and Java: you get useful type checking except when you declare
>     a reference as type ANY.  This is a shortcoming compared to:
> 
>     Python: where you get no useful type checking at all.
> 
The points that have repeatedly been made are:

1. That even the strict typings required by languages like Java and C++ 
actually end up getting in the way when the pragmatic requirements of 
real-world problems have to be taken into account.

2. That the benefits of declarations are overstated by many of their 
proponents.

3. That Python as it is today allows the dynamic creation of names, 
which are therefore inherently not available for declaration.

On existing evidence it's extremely unlikely that this post will end the 
thread, but I certainly wish *something* would. Unfortunately I seem to 
have become part of the problem in that respect :-)

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list