Kevlin,

>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?

I may not have been clear in saying that I think language definitions should not
give indentation a syntactic meaning.

Indentation can be a very useful visual aid in comprehending source code.

The dangers of having a translator treat indentation as significant, syntactically,
are software engineering ones.  Developers often cut and paste source.  It
is not uncommon for the copied source to have a different indentation.  Developers
don't always correctly re-indent the copied source.

We can debate whether it is more important for the copied code to have the scope
of the point it was pasted, or whether once copied the final visual appearance of the
source is the decides scope.  I have seen developers expect one of these and get
the other.

I have a belt and braces approach to the problem.  Opening and closing scope
markers should be used and indentation should be checked to ensure consistency
with the scope specified by these markers.  For instance, using C (I cannot
find my Python book to give an example in that language):

if (x == y)
   {
   z = 4;
if (x == 2)
   {
   z++;
   }
   }
y=3;

the second if-statement does not appear to have the expected indentation.
Without the { } (and assuming this code was written in an indentation sensitive
language) the meaning would be completely different.

I don't think it is possible to choose between the two obvious possibilities
about what the developer intended here.  The use of the scope makers
is not consistent with the indentation.  This can be flagged (ok most
translators don't flag it, but all good static analysis tools do :-) and the
developer has a second chance to get it right.

>>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

I was using 'neat' in the sense of trendy, impress your fellow workers
sense.  Not in the sense of neat and tidy.


derek

--
Derek M Jones                                           tel: +44 (0) 1252 520 667
Knowledge Software Ltd                            mailto:[EMAIL PROTECTED]
Applications Standards Conformance Testing   http://www.knosof.co.uk



- 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