[mercury-users] Re: Preferred coding style for switches
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Dec 17 01:32:30 AEDT 1999
On 10-Dec-1999, Gustavo A. Ospina <gos at info.fundp.ac.be> wrote:
>
> In my Mercury coding style, I prefer write the switches as:
>
> p(X) :-
> ( X = foo1,
> ...
> ;
> ...
> ;
> X = fooN,
> ...
> ).
>
> In this way I save one identation level, too. Of course, it's not the last
> word.
I think the use of 8-character tabs for indentation is probably
not a good idea. It makes sense in Prolog, where you tend to
have little indentation, because Prolog forces you to use
a separate predicate for every switch (since in general you only
get indexing on the top-level functor of the first argument).
But for Mercury I think using four spaces per level of indentation
would be a better idea.
(For the compiler itself, we use 8-character tabs, but
that's partly for historical reasons; changing now would
be quite costly. So this is a "do as I say, not as I do"
kind of advice ;-)
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list