[m-dev.] Tabling [1/3]

Oliver Hutchison ohutch at students.cs.mu.OZ.AU
Tue Mar 10 12:45:15 AEDT 1998


On Tue, 10 Mar 1998, Fergus Henderson wrote:

> 
> > compiler/modes.m:
> > 	Make sure that all procedures with non normal evaluation have 
> > 	no unique/partially instantiated modes. Produce error messages 
> > 	if they do.
> 
> Why?
> 

I don't support partially instantiated modes because that's a boundary case
that will require quite a bit of work.

Does it make sense to memo a predicate with unique modes?


> > compiler/simplify.m:
> > 	Only report infinite recursion warning if a procedure has
> > 	normal evaluation.
> 
> I think it would probably still be useful to issue this warning at
> compile time even if there is a `pragma loopcheck', because in general
> compile-time warnings are better than run-time errors.
> 

What about the case of memoing. It is then possible that the call will not
lead to infinite recursion? 

> 
> > +			{ pred_info_get_is_pred_or_func(PredInfo0, PredOrFunc) }
> > +		;
> > +				% XXX Fix this when we fix all the other 
> > +				% XXX pragmas that dont properly support this
> > +				% XXX case
> > +			{ error(
> > +"module_add_pragma_tabled: predicate and function with same name/arity") }
> > +		)
> > +	),
> 
> You should not call error/1 here.
> What you ought to do to handle the XXX case is the same as
> what all the other similar pragmas do: if there are multiple matching
> names, apply the pragma to all of them.   (You can do this easily
> by making the rest of this predicate into a separate predicate, and
> calling that predicate for each element of the list of pred_ids returned
> from predicate_table_search_sym_arity, perhaps using list__foldl2.)
> 

It is my intention to fix this in a separate change. I will make it
possible to specify ether pred or func within the pragma declaration,
something like :

:- pragma memo(func(blab/2)).

I expect this would be a good thing for all the pragma that suffer from
the pred func ambiguity (most of them!)? For backward compatibility I would
still allow the case where pred or func is not specified but would issue
an error message if there was a clash.


	





More information about the developers mailing list