diff: mostly-uniq modes changes

Fergus Henderson fjh at cs.mu.oz.au
Sun Sep 7 04:22:00 AEST 1997


A few small changes towards supporting backtrackable destructive update
better.

library/mercury_builtin.m:
	Add new insts mdi/1 and mostly_dead/0.

library/array.m:
	Change the name of the inst for unique arrays
	from `array' to `uniq_array' (someone got over-enthusiastic
	with global search and replace when uniq_array.m was
	renamed array.m).
	Add insts for non-unique arrays and mostly-unique arrays.

library/bt_array.m:
	Add a comment.

cvs diff: Diffing .
Index: array.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/array.m,v
retrieving revision 1.37
diff -u -u -r1.37 array.m
--- array.m	1997/07/28 12:07:36	1.37
+++ array.m	1997/09/06 17:43:25
@@ -20,18 +20,33 @@
 
 :- type array(T).
 
+:- inst array(I) = bound(array(I)).
+:- inst array == array(ground).
+:- inst array_skel == array(free).
+
 	% XXX the current Mercury compiler doesn't support `ui' modes,
 	% so to work-around that problem, we currently don't use
 	% unique modes in this module.
 
-% :- inst array(I) = unique(array(I)).
-:- inst array(I) = bound(array(I)).
-:- inst array == array(ground).
-:- inst array_skel == array(free).
+% :- inst uniq_array(I) = unique(array(I)).
+% :- inst uniq_array == uniq_array(unique).
+:- inst uniq_array(I) = bound(array(I)). % XXX work-around
+:- inst uniq_array == uniq_array(ground). % XXX work-around
+:- inst uniq_array_skel == uniq_array(free).
+
+:- mode array_di == di(uniq_array).
+:- mode array_uo == out(uniq_array).
+:- mode array_ui == in(uniq_array).
+
+% :- inst mostly_uniq_array(I) = mostly_unique(array(I)).
+% :- inst mostly_uniq_array == mostly_uniq_array(mostly_unique).
+:- inst mostly_uniq_array(I) = bound(array(I)).	% XXX work-around
+:- inst mostly_uniq_array == mostly_uniq_array(ground).	% XXX work-around
+:- inst mostly_uniq_array_skel == mostly_uniq_array(free).
 
-:- mode array_di == di(array).
-:- mode array_uo == out(array).
-:- mode array_ui == in(array).
+:- mode array_mdi == mdi(mostly_uniq_array).
+:- mode array_muo == out(mostly_uniq_array).
+:- mode array_mui == in(mostly_uniq_array).
 
 %-----------------------------------------------------------------------------%
 
Index: bt_array.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/bt_array.m,v
retrieving revision 1.3
diff -u -u -r1.3 bt_array.m
--- bt_array.m	1997/07/28 05:27:51	1.3
+++ bt_array.m	1997/09/06 17:34:42
@@ -12,6 +12,8 @@
 % a bt_array data structure.  This implementation allows O(log n) access
 % and update time, and does not require the bt_array to be unique.  If you
 % need O(1) access/update time, use the array datatype instead.
+% (`bt_array' is supposed to stand for either "binary tree array"
+% or "backtrackable array".)
 
 % Implementation obscurity: This implementation is biassed towards larger
 % indices.  The access/update time for a bt_array of size N with index I
Index: mercury_builtin.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/mercury_builtin.m,v
retrieving revision 1.82
diff -u -u -r1.82 mercury_builtin.m
--- mercury_builtin.m	1997/08/22 13:57:39	1.82
+++ mercury_builtin.m	1997/09/06 16:52:46
@@ -43,8 +43,10 @@
 % So are the standard unique insts `unique', `unique(...)',
 % `mostly_unique', `mostly_unique(...)', and `clobbered'.
 % The name `dead' is allowed as a synonym for `clobbered'.
+% Similarly `mostly_dead' is a synonym for `mostly_clobbered'.
 
 :- inst dead = clobbered.
+:- inst mostly_dead = mostly_clobbered.
 
 % The not yet properly supported `any' inst used for the
 % constraint solver interface is also builtin.
@@ -69,6 +71,7 @@
 :- mode in(Inst) :: (Inst -> Inst).
 :- mode out(Inst) :: (free -> Inst).
 :- mode di(Inst) :: (Inst -> clobbered).
+:- mode mdi(Inst) :: (Inst -> mostly_clobbered).
 
 % Unique modes.  These are still not fully implemented.
 
-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list