What If..... Strong Types

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Sun Jun 16 09:12:00 EDT 2002


----- Original Message -----
From: "Benno" <benjl at cse.unsw.edu.au>


> Don Garrett <garrett at bgb.cc> wrote in message
news:<3D0C0F0D.4030900 at bgb.cc>...
> > I'm not suggesting any real changes to any, only proposing a thought
> > experiment.
> >
> >    What if Python had been built from the start with strong types? And I
mean
> > strong types, not strong typing. The distinction I am trying to draw is
that
> > variables would not be typed, but that all types would have rigid
interfaces.
>
> <snip>
>
> >    I'm just wondering if the change would be good or bad. Would it
really
> > break anything important in Python today?
>
> Well, it would break my stuff, which is pretty damned important to me :).
> Dynamically creating/modifying things on the fly can produce nicer,
cleaner
> code than would otherwise be possible.

Indeed.  Those who truly grasp the Zen of Python never miss "strong typing"
of any sort.  Python is dynamic.  Failure to follow interface rules usually
results in raising an exception; in the cases where it is more subtle, it
seems to me that Python takes less time to debug than strong-typed languages
due to the parallel feature of introspection.

> > Would it prevent any common errors?
>
> Possibly but not that many imho.

I have rarely experienced errors related to an object's interface; usually
if I have it has been a simple typo which raised an exception.  What exactly
would I gain therefor with strong typing?  More typing (of the keyboard
variety)
for little gain.

> > Would it help with automated code analysis (compilation and optimization
> > included) as much as I think it would?
>
> Possibly, it is probably rather difficult to follow through all the
> implications of such as change however.

Exactly.  Trust Guido... he knows far better than most of us.


Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
http://newcenturycomputers.net






More information about the Python-list mailing list