Language change and code breaks

Christian Tanzer tanzer at swing.co.at
Mon Jul 23 02:03:35 EDT 2001


Paul Prescod <paulp at ActiveState.com> wrote:

> James Logajan wrote:
> > 
> > Guido van Rossum wrote:
> > > If you use this
> > > a lot (message = Message() etc.) your code is less readable than it
> > > should be.
> > 
> > Um, you've got that precisely reversed! If I see "message" anywhere in my
> > code, I know immediately that it is an instance of the class Message. Think
> > of it as an advanced form of Hungarian notation that tells you what type of
> > thing the variable is holding. (Although I'm no fan of Hungarian per se.)
> 
> The Ruby convention is aMessage which is really more clear. i.e.
> "message" could be of type string or of type Unicode or anything. I'm
> sure I've got code on my computer where message was of any of these
> types.

I've used the `aFoo` convention (and `theFoo`, too) in
case-insensitive languages like Ada. I stopped doing so as soon as I
used a case-sensitive language.

And I wouldn't claim `message` to be any sort of Hungarian notation.
As you note `message` might have many different types. 

Still, I like to be able to use the lowercase name to refer to an
object, while the same name capitalized refers to a class.

For the record, I started programming in case-insensitive languages
and had to use them for a long time. Although I prefer Ada over C++, I
really dislike the case blindness of Ada.

What's missing IMHO in this whole discussion is the question of costs
and benefits. In all written languages, there are costs for the reader
and a different set of costs for the writer. Normally, there is one
writer for many readers -- therefore one should try to reduce the
reader's costs. Unfortunately, many people completly disregard the
reader and campaign for reducing the costs of the writer (the hotly
contested reform of german writing rules is a prime example). For me,
the goal of making Python case-insensitive is also too preoccupied with
the writer's side of the game.  

-- 
Christian Tanzer                                         tanzer at swing.co.at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92





More information about the Python-list mailing list