In message <[EMAIL PROTECTED]>, Derek M
Jones <[EMAIL PROTECTED]> writes
>
>I think that relying on indentation only, to signal syntax, is
>a bad idea.  As luck would have it I was talking in the pub tonight
>with some Python programmers.  They thought that using indentation
>for this purpose was a great idea.  I completely failed to convince
>them of the inherent dangers (my complete lack of knowledge about
>Python did not help).  They were so engrossed in writing 'neat' code
>that they had no thoughts for subsequent readers of their code.  

I think that this is a mischaracterisation of Python programmers or what
'neat' code means to them. In Python neat code is pretty much by
definition readable -- your wording suggests that there is something
mutually exclusive going on, whereas the reality appears to be the
opposite. You may be interested in the following experience report by
Eric S Raymond:

        http://www.linuxjournal.com/article.php?sid=3882

As someone who has programmed in both free-format languages and syntax
sensitive languages I have found strengths and weaknesses in both that
suggest that the real issue may be elsewhere:

- In occam and Python indentation is used to indicate block nesting. In
other words, function follows form, and appears to be remarkably
convenient. Having used both of those languages, the adoption of the
style presented a hurdle no more than a millimetre in height because I
already indent code for that reason.

- In Fortran, indentation has a meaning unrelated to executable
function. The purpose of indentation is arbitrary and historical. It is
one of the many attributes that makes the language a displeasure to use.

- In free-format languages, or column-sensitive languages such as
Fortran, where block indentation is not required by the syntax, block
indentation is considered to be standard good practice, so you do it
anyway. Hmm, possible exception for Fortran: many years ago I was wading
through my boss's code, and he had stopped programming and moved onto
management just before really acquiring the indentation habit. The first
thing I did was indent the code, and lo and behold there was an obvious
bug. I showed him the original code, and he saw nothing wrong with it; I
showed him the indented code, and he spotted the bug immediately. A
sample case of one is not necessarily sufficient for serious science,
but it did nothing to weaken my preference and everything to reinforce
it!

- In free-format languages that use block-end markers, I have found that
in spite of a grounding in Fortran (with endif and enddo) and Pascal, I
find a lightweight end marker preferable -- the bracketing of Lisp,
Smalltalk and the C family, for example -- when used in combination with
indentation conventions.

- Free-format comments seem to be of less use than line-terminated
comments no matter what the style of the language.

These observations are personal, but for me it seems that where layout
is related to function and grouping there is no problem, and where it
isn't there is. This is surprisingly unsurprising, as similar
conventions are often used in laying out normal text, eg leading space
acts as a grouping and nesting delimiter in the index of many books.

>I
>frequently encounter this outlook, so I should not be surprised by it.
>But this time I thought I was onto a winner.

Why? The tale sounded like it was heading the opposite way... after all,
these were Python programmers ;-)

So I may have missed a posting, but what do you believe is the
compelling cognitive reason (as opposed to software tool reason) that
layout as indicator of meaning is definitively a bad idea? Or coming
from the other side, when -- cognitively -- is the absence of
indentation necessarily good?

Kevlin
____________________________________________________________

  Kevlin Henney                   phone:  +44 117 942 2990
  mailto:[EMAIL PROTECTED]     mobile: +44 7801 073 508
  http://www.curbralan.com        fax:    +44 870 052 2289
  Curbralan: Consultancy + Training + Development + Review
____________________________________________________________

- Automatic footer for [EMAIL PROTECTED] ----------------------------------
To unsubscribe from this list, mail [EMAIL PROTECTED]  unsubscribe discuss
To join the announcements list, mail [EMAIL PROTECTED] subscribe announce
To receive a help file, mail [EMAIL PROTECTED]         help
This list is archived at http://www.mail-archive.com/discuss%40ppig.org/
If you have any problems or questions, please mail [EMAIL PROTECTED]

Reply via email to