Related articles |
---|
[5 earlier articles] |
Re: Use of punctuation in a language? bobduff@shell01.TheWorld.com (Robert A Duff) (2003-11-08) |
Re: Use of punctuation in a language? bear@sonic.net (Ray Dillinger) (2003-11-11) |
Re: Use of punctuation in a language? jcownie@etnus.com (James Cownie) (2003-11-11) |
Re: Use of punctuation in a language? landauer@got.net (Doug Landauer) (2003-11-11) |
Re: Use of punctuation in a language? Martin.Ward@durham.ac.uk (Martin Ward) (2003-11-11) |
Re: Use of punctuation in a language? jvorbrueggen@mediasec.de (Jan C. =?iso-8859-1?Q?Vorbr=FCggen?=) (2003-11-21) |
Re: Use of punctuation in a language? vbdis@aol.com (2003-11-21) |
Re: Use of punctuation in a language? rkrayhawk@aol.com (2003-12-03) |
Re: Use of punctuation in a language? house@usq.edu.au (Ron House) (2003-12-03) |
From: | vbdis@aol.com (VBDis) |
Newsgroups: | comp.compilers |
Date: | 21 Nov 2003 00:46:38 -0500 |
Organization: | AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com |
References: | 03-11-059 |
Keywords: | design |
Posted-Date: | 21 Nov 2003 00:46:38 EST |
James Cownie <jcownie@etnus.com> schreibt:
>So
> a := b + c +
> d
>
>is fine, but
> a := b + c
> + d
>
>would give an error.
>
>Leaving a trailing operator at the end of the line is very simple to
>learn, and is also a good visual cue that the expression needs to
>continue.
That's one point of view. In your example you silently use indentation, to make
the continuation lines better perceptible to the human reader. This is not
necessarily possible in languages where indentation also has a syntactical
meaning. There also exist cases where a different indentation is not wanted,
and that's why I instead prefer to move operators to the begin of continuation
lines, so that the human(!) reader can identify continuation lines easily.
E.g.:
if a and b
and c then
some code
Now the continuation lines can have the same indentation as the continued line,
and different from the following code with deeper indentation.
Please note that multi-line statements typically have very long lines, and
typically are ragged at the end, so that it is NOT so obvious to the reader
which of these long lines have dangling operators at the end. Continuation
marks at the begin of the lines are much easier to recognize by humans,
regardless of whether operators or indentation is used for that purpose.
When writing this, I just came across another "punctuation" topic:
My example could be rewritten as
if a and b
and c
then
some code
where the continuation lines are indented, and the indentation is "restored" by
the "then" line. I don't like such additional lines, because they make the text
longer and consequently require more scrolling for the same amount of
information. But in C it would look strange when the ")" at the end of a
condition would stand in a line of its own.
DoDi
Return to the
comp.compilers page.
Search the
comp.compilers archives again.