Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Use of punctuation in a language?



James Cownie <[EMAIL PROTECTED]> 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



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.