[m-rev.] diff: Improve coding_standards.html
Mark Brown
dougl at cs.mu.OZ.AU
Tue Mar 19 16:22:21 AEDT 2002
Estimated hours taken: 0.1
Branches: main
Improvements to the "Layout" section of the Mercury coding standards.
compiler/notes/coding_standards.html:
Split the layout section into paragraphs, to make it easier to
read. Add the requirement that, like if-then-elses, all disjunctions
should be parenthesized.
Index: compiler/notes/coding_standards.html
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/notes/coding_standards.html,v
retrieving revision 1.3
diff -u -r1.3 coding_standards.html
--- compiler/notes/coding_standards.html 28 Nov 2000 05:08:47 -0000 1.3
+++ compiler/notes/coding_standards.html 19 Mar 2002 05:19:36 -0000
@@ -161,18 +161,24 @@
<h2> Layout </h2>
+<p>
+
Code should be indented consistently.
Tabs should be every 8 spaces.
Indentation should be one tab per level of indentation.
except for highly intended code which may be
indented at 4 spaces per level of indentation.
+
+<p>
+
Each line should not extend beyond 79 characters,
unless this is necessary due to the use of long string literals.
+
+<p>
+
If-then-elses should always be parenthesized,
except that an if-then-else that occurs as the else
part of another if-then-else doesn't need to be parenthesized.
-The semicolon of a disjunction should never be at the
-end of a line -- put it at the start of the next line instead.
The condition of an if-then-else can either be on the same
line as the opening parenthesis and the `->',
@@ -212,6 +218,14 @@
</pre>
+<p>
+
+Disjunctions should always be parenthesized.
+The semicolon of a disjunction should never be at the
+end of a line -- put it at the start of the next line instead.
+
+<p>
+
Type definitions should be formatted in the following style:
<pre>
@@ -232,6 +246,8 @@
</pre>
+<p>
+
If an individual clause is long, it should be broken into sections,
and each section should have a "block comment" describing what it does;
blank lines should be used to show the separation into sections.
@@ -264,6 +280,8 @@
</pre>
should be used.
+
+<p>
At a higher level, code should be grouped into bunches of related
predicates, functions, etc., and sections of code that are conceptually
@@ -282,6 +300,7 @@
can also be used to indicate divisions into major sections.
+<p>
<h2> Testing </h2>
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list