[mercury-users] hi & a feq queries
pets at students.cs.mu.OZ.AU
Tue Aug 18 11:29:23 AEST 1998
On Tue, 18 Aug 1998, Thomas Charles CONWAY wrote:
> There is another reason apart from efficiency that a switch should be
> preferred - once you've gone to the trouble (and it is rarely much
> trouble) of making all the cases (except the default) mutually
> exclusive, a switch is more likely to be more maintainable, simply
> because the compiler will detect it if your modifications lead to
> cases that are not mutually exclusive.
First of all, maintainability is not an issue in machine-generated code, so
I still think generating an if-then-else is sensible in the case under
Secondly, I don't understand your comment in this case. I understand how a
switch can help you maintain code when the switch covers all cases. If you
add an alternative to the switched-over type, the switch will change from
det to semidet. Great. But we're talking about a switch with a default, so
the switch part is already semidet. I don't see how you could change a type
so that a semidet disjunction is no longer semidet.
-Peter Schachte | The fantastic advances in the field of
mailto:pets at cs.mu.OZ.AU | communication constitute a grave danger to
http://www.cs.mu.oz.au/~pets/ | the privacy of the individual.
PGP: finger pets at 184.108.40.206 | -- Earl Warren
More information about the users