[m-rev.] diff: replace deprecated mode and inst syntax in library

Julien Fischer juliensf at cs.mu.OZ.AU
Sat Jul 17 03:00:24 AEST 2004


Estimated hours taken: 0.5
Branches: main

library/array.m:
library/builtin.m:
library/getopt.m:
library/io.m:
library/list.m:
library/tree234.m:
	Replace the deprecated syntax for :- inst and :- mode
	declarations.

Julien.

Index: array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.132
diff -u -r1.132 array.m
--- array.m	8 Jul 2004 05:03:06 -0000	1.132
+++ array.m	16 Jul 2004 16:23:39 -0000
@@ -63,7 +63,7 @@

 :- type array(T).

-:- inst array(I) = bound(array(I)).
+:- inst array(I) == bound(array(I)).
 :- inst array == array(ground).
 :- inst array_skel == array(free).

@@ -71,9 +71,9 @@
 	% so to work-around that problem, we currently don't use
 	% unique modes in this module.

-% :- inst uniq_array(I) = unique(array(I)).
+% :- 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(I) == bound(array(I)). % XXX work-around
 :- inst uniq_array == uniq_array(ground). % XXX work-around
 :- inst uniq_array_skel == uniq_array(free).

@@ -81,9 +81,9 @@
 :- 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(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(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).

Index: builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.103
diff -u -r1.103 builtin.m
--- builtin.m	20 Feb 2004 06:30:06 -0000	1.103
+++ builtin.m	16 Jul 2004 16:03:47 -0000
@@ -46,8 +46,8 @@
 % 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.
+:- inst dead == clobbered.
+:- inst mostly_dead == mostly_clobbered.

 % The `any' inst used for the constraint solver interface is also builtin.

@@ -61,40 +61,40 @@

 % The standard modes.

-:- mode unused :: (free -> free).
-:- mode output :: (free -> ground).
-:- mode input :: (ground -> ground).
-
-:- mode in :: (ground -> ground).
-:- mode out :: (free -> ground).
-
-:- mode in(Inst) :: (Inst -> Inst).
-:- mode out(Inst) :: (free -> Inst).
-:- mode di(Inst) :: (Inst -> clobbered).
-:- mode mdi(Inst) :: (Inst -> mostly_clobbered).
+:- mode unused == free >> free.
+:- mode output == free >> ground.
+:- mode input  == ground >> ground.
+
+:- mode in  == ground >> ground.
+:- mode out == free >> ground.
+
+:- 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.

 % unique output
-:- mode uo :: free -> unique.
+:- mode uo == free >> unique.

 % unique input
-:- mode ui :: unique -> unique.
+:- mode ui == unique >> unique.

 % destructive input
-:- mode di :: unique -> clobbered.
+:- mode di == unique >> clobbered.

 % "Mostly" unique modes (unique except that that may be referenced
 % again on backtracking).

 % mostly unique output
-:- mode muo :: free -> mostly_unique.
+:- mode muo == free >> mostly_unique.

 % mostly unique input
-:- mode mui :: mostly_unique -> mostly_unique.
+:- mode mui == mostly_unique >> mostly_unique.

 % mostly destructive input
-:- mode mdi :: mostly_unique -> mostly_clobbered.
+:- mode mdi == mostly_unique >> mostly_clobbered.

 % Higher-order predicate modes are builtin.

Index: getopt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/getopt.m,v
retrieving revision 1.29
diff -u -r1.29 getopt.m
--- getopt.m	5 Nov 2003 03:17:49 -0000	1.29
+++ getopt.m	16 Jul 2004 16:11:17 -0000
@@ -141,7 +141,7 @@
 				maybe_option_table(OptionType))
 		).

-:- inst option_ops =
+:- inst option_ops ==
 	bound((
 		option_ops(
 			pred(in, out) is semidet,	% short_option
Index: io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.323
diff -u -r1.323 io.m
--- io.m	7 Jul 2004 07:11:05 -0000	1.323
+++ io.m	16 Jul 2004 16:15:21 -0000
@@ -3034,7 +3034,7 @@
 :- type buffer ---> buffer(array(char)).

 	% XXX Extend the workaround for no `ui' modes in array.m.
-:- inst uniq_buffer = bound(buffer(uniq_array)).
+:- inst uniq_buffer == bound(buffer(uniq_array)).
 :- mode buffer_di == di(uniq_buffer).
 :- mode buffer_uo == out(uniq_buffer).

Index: list.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.119
diff -u -r1.119 list.m
--- list.m	9 Jun 2004 14:47:11 -0000	1.119
+++ list.m	15 Jul 2004 08:54:06 -0000
@@ -32,27 +32,27 @@
 	% Partially instantiated mode aren't fully implemented yet,
 	% so don't try to use these.

-:- inst list_skel(I) = bound(([] ; [I | list_skel(I)])).
-:- inst list_skel = list_skel(free).
+:- inst list_skel(I) ---> [] ; [I | list_skel(I)].
+:- inst list_skel == list_skel(free).

-:- inst non_empty_list = bound([ground | ground]).
+:- inst non_empty_list ---> [ground | ground].

-:- mode in_list_skel :: list_skel -> list_skel.
-:- mode out_list_skel :: free -> list_skel.
-:- mode list_skel_out :: list_skel -> ground.
+:- mode in_list_skel  == list_skel >> list_skel.
+:- mode out_list_skel == free >> list_skel.
+:- mode list_skel_out == list_skel >> ground.

 	% These more verbose versions are deprecated.
 	% They exist only for backwards compatibility,
 	% and will be removed in a future release.
-:- mode input_list_skel :: in_list_skel.
-:- mode output_list_skel :: out_list_skel.
-:- mode list_skel_output :: list_skel_out.
+:- mode input_list_skel  == in_list_skel.
+:- mode output_list_skel == out_list_skel.
+:- mode list_skel_output == list_skel_out.

 	% These modes are particularly useful for passing around lists
 	% of higher order terms, since they have complicated insts
 	% which are not correctly approximated by "ground".
-:- mode list_skel_in(I) :: list_skel(I) -> list_skel(I).
-:- mode list_skel_out(I) :: free -> list_skel(I).
+:- mode list_skel_in(I)  == list_skel(I) >> list_skel(I).
+:- mode list_skel_out(I) == free >> list_skel(I).

 %-----------------------------------------------------------------------------%

Index: tree234.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/tree234.m,v
retrieving revision 1.40
diff -u -r1.40 tree234.m
--- tree234.m	22 Dec 2003 11:21:48 -0000	1.40
+++ tree234.m	15 Jul 2004 17:21:53 -0000
@@ -200,8 +200,8 @@

 :- import_module int, require, bool, std_util.

-:- type tree234(K, V)	--->
-		empty
+:- type tree234(K, V)
+	--->	empty
 	;	two(K, V, tree234(K, V), tree234(K, V))
 	;	three(K, V, K, V, tree234(K, V), tree234(K, V), tree234(K, V))
 	;	four(K, V, K, V, K, V, tree234(K, V), tree234(K, V),
@@ -209,7 +209,7 @@

 :- interface.

-:- inst uniq_tree234(K, V) =
+:- inst uniq_tree234(K, V) ==
 	unique((
 		empty
 	;	two(K, V, uniq_tree234(K, V), uniq_tree234(K, V))
@@ -219,7 +219,7 @@
 			uniq_tree234(K, V), uniq_tree234(K, V))
 	)).

-:- inst uniq_tree234_gg =
+:- inst uniq_tree234_gg ==
 	unique((
 		empty
 	;	two(ground, ground, uniq_tree234_gg, uniq_tree234_gg)
@@ -230,10 +230,10 @@
 			uniq_tree234_gg, uniq_tree234_gg)
 	)).

-:- mode di_tree234(K, V) :: uniq_tree234(K, V) -> dead.
-:- mode di_tree234       :: uniq_tree234(ground, ground) -> dead.
-:- mode uo_tree234(K, V) :: free -> uniq_tree234(K, V).
-:- mode uo_tree234       :: free -> uniq_tree234(ground, ground).
+:- mode di_tree234(K, V) == uniq_tree234(K, V) >> dead.
+:- mode di_tree234       == uniq_tree234(ground, ground) >> dead.
+:- mode uo_tree234(K, V) == free >> uniq_tree234(K, V).
+:- mode uo_tree234       == free >> uniq_tree234(ground, ground).

 :- implementation.

@@ -746,51 +746,29 @@
 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%

-:- inst two(K, V, T) =
-	bound(
-		two(K, V, T, T)
-	).
-
-:- inst uniq_two(K, V, T) =
-	unique(
-		two(K, V, T, T)
-	).
-
-:- inst three(K, V, T) =
-	bound(
-		three(K, V, K, V, T, T, T)
-	).
-
-:- inst uniq_three(K, V, T) =
-	unique(
-		three(K, V, K, V, T, T, T)
-	).
-
-:- inst four(K, V, T) =
-	bound(
-		four(K, V, K, V, K, V, T, T, T, T)
-	).
-
-:- inst uniq_four(K, V, T) =
-	unique(
-		four(K, V, K, V, K, V, T, T, T, T)
-	).
-
-:- mode uo_two :: out(uniq_two(unique, unique, unique)).
-:- mode suo_two :: out(uniq_two(ground, ground, uniq_tree234_gg)).
-:- mode out_two :: out(two(ground, ground, ground)).
-
-:- mode di_two :: di(uniq_two(unique, unique, unique)).
-:- mode sdi_two :: di(uniq_two(ground, ground, uniq_tree234_gg)).
-:- mode in_two :: in(two(ground, ground, ground)).
-
-:- mode di_three :: di(uniq_three(unique, unique, unique)).
-:- mode sdi_three :: di(uniq_three(ground, ground, uniq_tree234_gg)).
-:- mode in_three :: in(three(ground, ground, ground)).
-
-:- mode di_four :: di(uniq_four(unique, unique, unique)).
-:- mode sdi_four :: di(uniq_four(ground, ground, uniq_tree234_gg)).
-:- mode in_four :: in(four(ground, ground, ground)).
+:- inst two(K, V, T)   ---> two(K, V, T, T).
+:- inst three(K, V, T) ---> three(K, V, K, V, T, T, T).
+:- inst four(K, V, T)  ---> four(K, V, K, V, K, V, T, T, T, T).
+
+:- inst uniq_two(K, V, T)   == unique(two(K, V, T, T)).
+:- inst uniq_three(K, V, T) == unique(three(K, V, K, V, T, T, T)).
+:- inst uniq_four(K, V, T)  == unique(four(K, V, K, V, K, V, T, T, T, T)).
+
+:- mode uo_two  == out(uniq_two(unique, unique, unique)).
+:- mode suo_two == out(uniq_two(ground, ground, uniq_tree234_gg)).
+:- mode out_two == out(two(ground, ground, ground)).
+
+:- mode di_two  == di(uniq_two(unique, unique, unique)).
+:- mode sdi_two == di(uniq_two(ground, ground, uniq_tree234_gg)).
+:- mode in_two  == in(two(ground, ground, ground)).
+
+:- mode di_three  == di(uniq_three(unique, unique, unique)).
+:- mode sdi_three == di(uniq_three(ground, ground, uniq_tree234_gg)).
+:- mode in_three  == in(three(ground, ground, ground)).
+
+:- mode di_four  == di(uniq_four(unique, unique, unique)).
+:- mode sdi_four == di(uniq_four(ground, ground, uniq_tree234_gg)).
+:- mode in_four  == in(four(ground, ground, ground)).

 %------------------------------------------------------------------------------%

--------------------------------------------------------------------------
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