Eike Lange wrote:
While discussing about different Pascal-styles for the pindent-program there came up a question my books can't answer:
How are the different styles called, which one can use for coding:
array [1..3] <===> array (.1..3.) and { comment } <===> (* Comment *)
The standard calls the latter "lexical alternatives".
BTW, another alternative is `@' for `^' (really!)... :-/
BTW: Why did these styles came up?
I think to support old character sets that didn't have [], {} and the `^' or, equivalently, an "up arrow" character.
Is one of them "old-fashioned"?
I think most people would consider `(. .)' as well as `@' in place of `^' old-fashioned (or rather, most people might not even have heard of them ;-).
With the comment delimiters, there seem to be different opinions. I personally prefer `{ }' (analogous to `[ ]'), but Peter prefers `(* *)' so that comments are more visible.
Therefore I've made the following suggestion: Put normal (descriptive) comments in `{ }', e.g. `{ This procedure does blah blah. Its arguments are a string foo and ... }', but comments that demand special attention in `(* *)', e.g. Dec (x); (* x was incremented once too often in the previous loop *)
Finally, compiler directives should IMHO be put in `{$ }' (if they need special attention, they can always be followed by a `(* *)' comment, of course).
To implement this style in an automatic tool might seem hard, but actually might not be so difficult. Descriptive comments are always immediately before a declaration (or maybe after a declaration on the same line if this is considered good style), while the other kind of comments occurs in a statement block.
Oh yeah, another thing to complicate the issue: To indicate "FIXME"s, we're currently using two or more (depending on the urgency) `@'s in a comment -- then, of course, always `(* *)' comments because they obviously require special attention. So, e.g.:
(*@@ This procedure is a temporary kludge. It will disappear when foobar has been done correctly. *) procedure foobar_kludge;
This comment should, of course, not be converted to `{@@ }', even if it's before a declaration, but for a program it's also not hard to recognize the `@'...
Frank