[m-dev.] Tuples and pairs

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Dec 21 17:26:26 AEDT 2001


On 21-Dec-2001, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Result: not so good.  Switch detection does not work on code like the
> following:
> 
> f([]) = ...
> f([cons1 - X | _]) = ...
> f([cons2 - X | _]) = ...
> f([cons3 - X | _]) = ...
> 
> The problem arises because switch detection only looks as far as the
> first call in each disjunct, rather than the first semidet goal.
> 
> This is fixable, but non-trivial and hence will have to wait until after
> Xmas.

This is not the first time that non-intuitive nature of the compiler's current
behavior has come up. There is a good case to be made that switch detection
should search each disjunct until the first *predicate* call, and that it
should not stop at *function* calls.

That modification isn't too hard; you just need to add a bit of code to
find_bind_var in switch_detection.m to step past function calls and
generic_calls. I'll put it on my plate for next week.

Zoltan.
--------------------------------------------------------------------------
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