Guido's intuition (was Re: typetesting, adaptation, typeclasses, ...)

James_Althoff at i2.com James_Althoff at i2.com
Mon Feb 4 14:34:05 EST 2002


[Tim Hammerquist]
>Imagine a "Lisp-style" indent!
>
>if ( some_condition() ) {
>    i = first_i();
>    for (i = first_i(); i <= 10; i++) {
>        initialize_some_stuff();
>        while ( some_other_condition() ) {
>            do_some_more_stuff() } } }

Although one rarely encounters the above indentation style in C/C++/C#/Java
code -- and, in fact, one occasionally sees the suggestion of said style
accompanied by giggling ridicule -- it is amusing to reminisce about the
path taken by the Smalltalk-80 development team.  Smalltalk-80 has block
delimiters "[" and "]".  When we first started implementing the
Smalltalk-80 system (all of which was written in Smalltalk itself, save the
VM, object memory, and primitives) we had the usual debates about delimiter
style.  As with C coders since the dawn of time, each style had strong
advocates.  And each developer used his/her style of choice.  Until ...
Dan Ingalls, who was the lead architect for Smalltalk-80, had a very strong
preference for the above "indentation-based" style.  And he was clever
enough to write a pretty-print routine that converted code to his preferred
style *and* to add a call to his pretty-printer to the "compile" menu in
the editor.  Voila.  No more inconsistency and no more debates.  Although
not everyone immediately appreciated this direct approach to "solving" the
"inconsistent style" problem, the end result -- interestingly -- was that
*all* early Smalltalk-80 code had a very nice "Pythonic"
indentation-oriented look and feel (assuming that you ignored a little bit
of cruft at the end of each line <wink>).  Note that finding matching
brackets was not an issue because the editor had a feature whereby if you
clicked inside a left bracket it would highlight all text to the matching
right bracket.

(And, I suppose, the next step should have been to put the pretty-print/tab
stuff in the compiler itself <wink>)

Jim





More information about the Python-list mailing list