[m-dev.] proposed update of coding standards

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Mar 30 16:39:21 AEST 2005

Any comments?


Index: coding_standards.html
RCS file: /home/mercury/mercury1/repository/mercury/compiler/notes/coding_standards.html,v
retrieving revision 1.17
diff -u -b -r1.17 coding_standards.html
--- coding_standards.html	30 Mar 2005 06:19:25 -0000	1.17
+++ coding_standards.html	30 Mar 2005 06:37:10 -0000
@@ -44,8 +44,8 @@
-Each predicate other than trivial access predicates should have
-a short comment describing what the predicate is supposed to do,
+Each predicate other than trivial access predicates
+should have a short comment describing what the predicate is supposed to do,
 and what the meaning of the arguments is.
 Ideally this description should also note any conditions
 under which the predicate can fail or throw an exception.
@@ -210,6 +210,18 @@
+Since "empty" lines that have spaces or tabs on them
+prevent the proper functioning of paragraph-oriented commands in vi,
+lines shouldn't have trailing white space.
+They can be removed with a vi macro such as the following.
+(Each pair of square brackets contains a space and a tab.)
+	map ;x :g/[     ][      ]*$/s///^M
 String literals that don't fit on a single line should be split
 by writing them as two or more strings concatenated using the "++" operator;
 the compiler will evaluate this at compile time,
@@ -268,6 +280,25 @@
 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.
+Predicates and functions implemented via foreign code should be formatted
+like this:
+:- pragma foreign_proc("C",
+        int__to_float(IntVal::in, FloatVal::out),
+        [will_not_call_mercury, promise_pure],
+        FloatVal = IntVal;
+The predicate name and arguments should be on a line on their own,
+as should the list of annotations.
+The foreign code should also be on lines of its own;
+it shouldn't share lines with the double quote marks surrounding it.
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list