"no variable or argument declarations are necessary."

Antoon Pardon apardon at forel.vub.ac.be
Fri Oct 7 06:26:39 EDT 2005


Op 2005-10-07, Steve Holden schreef <steve at holdenweb.com>:
> Antoon Pardon wrote:
>> Op 2005-10-06, Diez B. Roggisch schreef <deets at nospam.web.de>:
>> 
>>>>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.
>>>
>>>The you have JAVA Object or C void*. Which cause all kinds of runtime 
>>>troubles.... because they essentially circumvene the typechecking!
>> 
>> 
>> 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.
>> 
> [sigh]. No, it's just you being you. 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).

It is not about falling back on generic declarartion, it is about
how such object will be treated. Diez seems to think that
strongly-typed language can only deal with generic declarations
by using something that allows circumventing the type system.

> 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.

And you are wrong. The problem with the C void* construct (I'm not that
familiar with java) is that all type information is lost. When you
use such a parameter in a function you have no idea what you are
working with.

But that doesn't need to be if you have a typesystem with an ANY type.
Such a type declaration would mean that object of any type could be
used here. However that doesn't imply that the type information
of the actual objects used, has to be lost. That type information
may still be available and usefull for further type checking.

That you and Diez can only think about C, C++ or java constructs
when I mention an ANY type, is your limitation. It doesn't
need to be the limitation of a specific type system.

-- 
Antoon Pardon



More information about the Python-list mailing list