Perl is worse!

Eric Lorenzo zo at angband.org
Fri Jul 28 12:49:57 EDT 2000


grey at despair.rpglink.com (Steve Lamb) writes:
>     And I meant what I typed and do and I don't need the language
> telling me that I'm the stupid one.

I've got news for you, Steve: You may not be the stupid one, but you
*are* the ignorant one.  And so am I, and so is any other programmer
who is dealing with a piece of code that he hasn't looked at in months
(if ever).  Programmers in that position are typically unaware of many
of the details that were in the mind of the code's original author
(even if it is their own code - people, including you, forget things).
When a programmer has explicitly laid out what a program is to do, it
will be far easier for that code to be understood, later.

Typing isn't intrinsically required for communicating with the
computer.  As you point out, we could simply treat each value is an
untyped glob of bytes, and let the operations that the omniscient
programmer specifies determine how it is treated.

But communication with the *computer* isn't actually the primary
purpose of typing.  Rather, typing is a means for programmers to
communicate with themselves and with other programmers.  It provides
them with a mental framework on which to hang some of their
meta-knowledge about a particular glob of data, and more importantly,
a way to explicitly and unambiguously make note of that meta-knowledge
in the code.

When I read a piece of Python code that passes an string to 'int()'
immediately after reading it from the user, I know that the original
programmer was expecting the user to input an integer.  It's
considerably harder to figure out the programmer's expectations when
reading a piece of Perl code that reads an input string and doesn't
bother doing any explicit conversions, instead depending on the
language to implicitly coerce to integer where it's appropriate.

Eric



More information about the Python-list mailing list