[m-dev.] for review: fix switch-detection bug

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Aug 31 13:59:10 AEST 1999

On 31-Aug-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> compiler/switch_detection.m:
> 	Fix a bug - the code was looking for switch deconstructions
> 	after the first call in each branch. Doing this can remove
> 	infinite loops, which the strict sequential semantics does
> 	not allow.
> 	Discuss the backwards incompatibility effects of this change. 
> doc/reference_manual.texi:
> 	Add some more documentation about where the test unifications
> 	in switches can occur.
> tests/invalid/Mmakefile:
> tests/invalid/not_a_switch.m:
> 	Test case.

Those changes look great, thanks.

> > Would it be worth adding an option, e.g. `--backwards-compat 0.8',
> > that would preserve the old behaviour, in case anyone had written
> > code that relied on it?
> Probably not, because fixing affected code is trivial. It's just as
> simple to fix the code as to use an option to disable the error messages.

Fair enough.

> By the way, the problem wasn't introduced in the revision you pointed out.
> It was introduced in revision 1.81 of switch_detection.m, where the ability
> to search for deconstructions in existential qualifications was added.

Oh, in that case I guess it was my fault -- sorry about that.
And thanks for the fix!


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        |     -- the last words of T. S. Garp.
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