[m-dev.] semantics with any insts

Peter Schachte schachte at csse.unimelb.edu.au
Mon Apr 3 12:01:42 AEST 2006

On Mon, Apr 03, 2006 at 11:37:55AM +1000, Ralph Becket wrote:
> Peter Schachte, Monday,  3 April 2006:
> >Maybe today a solver writer implements a primitive
> > constraint by backtracking over possible solutions because it's easy,
> > and tomorrow does something clever to avoid backtracking.
> That sort of implementation detail *should* remain hidden, regardless of
> whether detisms are given a declarative or operational reading.  Maybe
> I've misunderstood; can you give an example of what you have in mind?

Say I'm implementing a cbool type.  I implement the common connectives
as "semidet" preds, but I get lazy handling xor for some reason, and
just implement it to backtrack over (true,false) and (false,true), so
I (correctly) declare it nondet.  Then several users complain that
it's too inefficient, so I make it do the correct bookkeeping so I
don't have to backtrack over solutions, but I'm still too lazy to 
check that the goal is satisfiable, so I change the declaration to
"det."  Then after more cajoling, I finally do the right thing and
change the declaration to "semidet."  But then I get more complaints,
this time because the data structures grow too large, so I modify the
code to check if this is happening, and backtrack over the
alternatives when that happens, so I have to change it back to nondet.
And every time I change it, all the users scurry back to their code
and change the determinisms of most of their predicates, cursing that
this drudgery is the kind of things computers are supposed to be good

Peter Schachte              The art of progress is to preserve order amid
schachte at cs.mu.OZ.AU        change, and to preserve change amid order.
www.cs.mu.oz.au/~schachte/      -- Alfred North Whitehead 
Phone: +61 3 8344 1338      
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