[m-dev.] Aditi updates

Peter Schachte pets at cs.mu.OZ.AU
Fri Dec 4 17:05:51 AEDT 1998


Hi Simon,

On Fri, Dec 04, 1998 at 02:13:57PM +1100, Simon Taylor wrote:

> For example, for a base relation with declaration:
> :- pred edge(aditi:state::ui, int::out, int::out) is nondet.
> :- pragma base_relation(edge/3).
> 
> the compiler automatically defines:
> 
> :- pred edge_insert(int::in, int::in,
> 		aditi__state::di, aditi__state::uo) is det.
> 
> :- pred edge_delete(int::in, int::in,
> 		aditi__state::di, aditi__state::uo) is det.
> 
> :- pred edge_bulk_insert(pred(int::in, int::in, aditi__state::ui) is nondet, 
> 		aditi__state::di, aditi__state::uo) is det.
> 		
> :- pred edge_bulk_delete(pred(int::in, int::in, aditi__state::ui) is nondet, 
> 		aditi__state::di, aditi__state::uo) is det.

I don't understand the last two.  How do they work?  I would have
expected the first one to be

	:- pred edge_bulk_insert(
			pred(int::out, int::out, aditi__state::ui) is nondet, 
	 		aditi__state::di, aditi__state::uo) is det.

and the second to be either

	:- pred edge_bulk_delete(
			pred(int::in, int::in, aditi__state::ui) is semidet,
			aditi__state::di, aditi__state::uo) is det.

(the pred is called with each tuple in the relation to see if it
should be deleted), or

	:- pred edge_bulk_delete(
			pred(int::out, int::out, aditi__state::ui) is nondet, 
			aditi__state::di, aditi__state::uo) is det.

(the pred generates every tuple which should be deleted).


> Assuming a primary key on attribute 1 (the first integer attribute),
> we also get:

Why should any extra relations be generated for tables with indices?
Can't you use the same predicate name?  If you can't because you are
generating Mercury rather than pragma C code, maybe the time has come
to finally allow different Mercury code for different modes of the
same predicate.  It would certainly seem cleaner to me not to have a
different predicate name for each mode.


-- 
Peter Schachte                | Mr. Spock succumbs to a powerful mating urge
mailto:pets at cs.mu.OZ.AU       | and nearly kills Captain Kirk. -- TV Guide,
http://www.cs.mu.oz.au/~pets/ | describing the Star Trek episode _Amok_Time_ 
PGP: finger pets at 128.250.37.3 | 



More information about the developers mailing list