[m-rev.] for review: add a test coverage scenario

Erwan Jahier Erwan.Jahier at irisa.fr
Tue Aug 21 00:14:27 AEST 2001


Fergus wrote:
| > +:- pred call_site_to_call_site_crit(list(proc_det)::in, call_site::in, 
| > +	call_site_crit::out) is det.
| > +call_site_to_call_site_crit(Pdl, Cs, Csc) :-
| > +% XXX Actually, there can be more than one solution if several procs
| > +% have the same name in different modules. I need the type inference
| > +% result to solve that problem. Note that it should not occur too often,
| > +% and when it happens, the determinism ougth to be the same 
| > +% (e.g., append for lists and strings...)
| > +%
| > +% XXX It would also require a mode analysis to know in which mode append is
| > +% called... Sigh, I should really parse the HLDS ...
| > +%
| > +% It means that I suppose it works for one mode => one predicate !
| > +% 
| > +% Well, the false entry probably can be fixed by hand...
| > +%
| 
| Rather than using promise_only_solution here, when you know it isn't always
| the only solution, you should just call solutions/2 and get the first element
| of the list (give the called predicate determinism `multi' rather than
| `cc_multi').  The XXX comment should stay, but at least you won't be lying
| to the compiler...

Ok thanks, but how do you say to the compiler that when calling via 
solutions/2 a multidet predicate, you necessarily obtain a not empty list?

In other words, how to make the compiler aware that the call to
`solutions(closure, [FirstSol | _])' will not fail? 

Of course I can have something like:
 `solutions(closure, Sol), (Sol = [FirstSol | _] ; Sol = [], error("..."))',
but that's a pain.
-- 
R1.


--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list