[mercury-users] Preferred coding style for switches

Richard A. O'Keefe ok at hermes.otago.ac.nz
Fri Dec 10 08:10:32 AEDT 1999


	The many-clauses style, I feel, makes it more obvious that one is coding
	up a table of some sort.  The down-side is that you can end up duplicating a
	lot of boilerplate in the extra clause headers.

The important lesson Kierkegaard was trying to get across in Either/Or
was that the two alternatives he described were so repulsive that
people's belief that those were *the* alternatives had to be wrong;
there had to be other alternatives.

Very often when we find ourselves stuck between two unpalatable
alternatives it's because we haven't considered whether there might
be a third, or fourth, or fifth.

One of the things that Mercury lost is `term_expansion/2'; the
ability to extend syntax in a Lispy way.  That doesn't mean you CAN'T
set up your own syntax, it just means it's not quite trivial to plug
things in.

Nevertheless, if you have enough tables and they are big enough that
readability is a serious worry for you, it might well be worth defining
some less repetitious syntax which you are sure its readable, and
sticking in a wee program to transform it to Mercury.
--------------------------------------------------------------------------
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