[m-dev.] for review: `:- assertion' to `:- promise'

Peter Ross petdr at cs.mu.OZ.AU
Fri Nov 12 14:38:36 AEDT 1999


Hi,

This change will require bootstraping, when I delete all the code which
handles `:- assertion' declarations.

Is this the correct process?
    1. Wait for this change to install on all the machines over the
       weekend.
    2. Add a sticky tag bootstrap_YYYYMMDD_<short_description_of_change>,
       to the compiler directory.
    3. Delete the code which handles `:- assertion', marked with `XXX
       assertion bootstrap'.
    4. Do all the other stuff (configure, int assertions to promises).
    5. Check in my new version of the compiler.

===================================================================


Estimated hours taken: 2

Change from `:- assertion' to `:- promise'.

compiler/assertion.m:
compiler/error_util.m:
compiler/hlds_data.m:
compiler/hlds_out.m:
compiler/make_hlds.m:
compiler/mercury_to_goedel.m:
compiler/mercury_to_mercury.m:
compiler/prog_io.m:
compiler/notes/glossary.html:
doc/transition_guide.texi:
library/ops.m:
    Change all externally visible references to promise from assertion.

Index: compiler/assertion.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/assertion.m,v
retrieving revision 1.4
diff -u -r1.4 assertion.m
--- assertion.m	1999/11/11 23:04:00	1.4
+++ assertion.m	1999/11/12 03:00:17
@@ -515,7 +515,7 @@
 	io__write_string("':\n"),
 
 	prog_out__write_context(Context),
-	io__write_string("  error: exported assertion refers to "),
+	io__write_string("  error: exported promise refers to "),
 	(
 		{ Type = call(PredOrFunc, SymName, Arity) },
 		hlds_out__write_simple_call_id(PredOrFunc, SymName, Arity),
@@ -538,7 +538,7 @@
 		{ VerboseErrors = yes }
 	->
 		prog_out__write_context(Context),
-		io__write_string("  Either move the assertion into the "),
+		io__write_string("  Either move the promise into the "),
 		io__write_string("implementation section\n"),
 
 		prog_out__write_context(Context),
Index: compiler/error_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/error_util.m,v
retrieving revision 1.10
diff -u -r1.10 error_util.m
--- error_util.m	1999/07/13 08:52:51	1.10
+++ error_util.m	1999/11/11 23:56:18
@@ -336,7 +336,7 @@
 	(
 		pred_info_get_goal_type(PredInfo, assertion)
 	->
-		Piece = "assertion"
+		Piece = "promise"
 	;
 		string__int_to_string(OrigArity, ArityPart),
 		string__append_list([
Index: compiler/hlds_data.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_data.m,v
retrieving revision 1.40
diff -u -r1.40 hlds_data.m
--- hlds_data.m	1999/10/26 14:48:44	1.40
+++ hlds_data.m	1999/11/11 23:52:29
@@ -816,7 +816,7 @@
 	% An assertion is a goal that will always evaluate to true,
 	% subject to the constraints imposed by the quantifiers.
 	%
-	% ie :- assertion all [A] some [B] (B > A)
+	% ie :- promise all [A] some [B] (B > A)
 	% 
 	% The above assertion states that for all possible values of A,
 	% there will exist at least one value, B, such that B is greater
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/hlds_out.m,v
retrieving revision 1.230
diff -u -r1.230 hlds_out.m
--- hlds_out.m	1999/11/11 23:11:50	1.230
+++ hlds_out.m	1999/11/11 23:57:32
@@ -330,7 +330,7 @@
 	;
 		{ pred_info_get_goal_type(PredInfo, assertion) }
 	->
-		io__write_string("assertion")
+		io__write_string("promise")
 	;
 		hlds_out__write_simple_call_id(PredOrFunc,
 			qualified(Module, Name), Arity)
@@ -847,7 +847,7 @@
 		) },
 
 	hlds_out__write_indent(Indent),
-	io__write_string(":- assertion all["),
+	io__write_string(":- promise all["),
 	io__write_list(HeadVars, ", ", PrintVar),
 	io__write_string("] (\n"),
 
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/make_hlds.m,v
retrieving revision 1.313
diff -u -r1.313 make_hlds.m
--- make_hlds.m	1999/11/11 23:11:55	1.313
+++ make_hlds.m	1999/11/11 23:58:33
@@ -725,7 +725,7 @@
 		% leverage off all the other checks in the compiler that
 		% operate on predicates.
 		%
-		% :- assertion all [A,B,R] ( R = A + B <=> R = B + A ).
+		% :- promise all [A,B,R] ( R = A + B <=> R = B + A ).
 		%
 		% becomes
 		%
@@ -2932,7 +2932,7 @@
 			{ prog_out__sym_name_to_string(PredName, NameString) },
 			{ string__format("%s %s %s (%s).\n",
 				[s("Attempted to introduce a predicate"),
-				s("for an assertion with an identical"),
+				s("for a promise with an identical"),
 				s("name to an existing predicate"),
 				s(NameString)], String) },
 			{ error(String) }
Index: compiler/mercury_to_goedel.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_goedel.m,v
retrieving revision 1.67
diff -u -r1.67 mercury_to_goedel.m
--- mercury_to_goedel.m	1999/07/09 01:15:32	1.67
+++ mercury_to_goedel.m	1999/11/12 03:01:52
@@ -205,7 +205,7 @@
 goedel_output_item(assertion(_, _), _Context) -->
 	io__stderr_stream(Stderr),
 	io__write_string(Stderr, 
-			"warning: assertion declarations not allowed. Ignoring\n").
+			"warning: promise declarations not allowed. Ignoring\n").
 
 goedel_output_item(nothing, _) --> [].
 goedel_output_item(typeclass(_, _, _, _, _), _) -->
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.162
diff -u -r1.162 mercury_to_mercury.m
--- mercury_to_mercury.m	1999/10/16 06:26:42	1.162
+++ mercury_to_mercury.m	1999/11/12 00:02:08
@@ -428,7 +428,7 @@
 	).
 
 mercury_output_item(assertion(Goal, VarSet), _) -->
-	io__write_string(":- assertion "),
+	io__write_string(":- promise "),
 	{ Indent = 1 },
 	mercury_output_newline(Indent),
 	mercury_output_goal(Goal, VarSet, Indent),
@@ -2838,6 +2838,7 @@
 mercury_unary_prefix_op("\\+").
 mercury_unary_prefix_op("aditi_bottom_up").
 mercury_unary_prefix_op("aditi_top_down").
+	% XXX assertion bootstrap
 mercury_unary_prefix_op("assertion").
 mercury_unary_prefix_op("delete").
 mercury_unary_prefix_op("dynamic").
@@ -2859,6 +2860,7 @@
 mercury_unary_prefix_op("once").
 mercury_unary_prefix_op("pragma").
 mercury_unary_prefix_op("pred").
+mercury_unary_prefix_op("promise").
 mercury_unary_prefix_op("pure").
 mercury_unary_prefix_op("rule").	/* NU-Prolog */
 mercury_unary_prefix_op("semipure").
Index: compiler/prog_io.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/prog_io.m,v
retrieving revision 1.183
diff -u -r1.183 prog_io.m
--- prog_io.m	1999/07/12 14:09:12	1.183
+++ prog_io.m	1999/11/12 00:00:54
@@ -1042,7 +1042,12 @@
 	parse_pragma(ModuleName, VarSet, Pragma, Result0),
 	check_no_attributes(Result0, Attributes, Result).
 
+	% XXX assertion bootstrap
 process_decl(ModuleName, VarSet, "assertion", Assertion, Attributes, Result):-
+	parse_assertion(ModuleName, VarSet, Assertion, Result0),
+	check_no_attributes(Result0, Attributes, Result).
+
+process_decl(ModuleName, VarSet, "promise", Assertion, Attributes, Result):-
 	parse_assertion(ModuleName, VarSet, Assertion, Result0),
 	check_no_attributes(Result0, Attributes, Result).
 
Index: compiler/notes/glossary.html
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/notes/glossary.html,v
retrieving revision 1.3
diff -u -r1.3 glossary.html
--- glossary.html	1999/07/09 01:16:19	1.3
+++ glossary.html	1999/11/11 23:28:46
@@ -15,7 +15,7 @@
 
 <dl>
 
-<dt> assertion
+<dt> assertion/promise
 	<dd>
     A declaration that specifies a law that holds for the
     predicates/functions in the declaration.
Index: doc/transition_guide.texi
===================================================================
RCS file: /home/staff/zs/imp/mercury/doc/transition_guide.texi,v
retrieving revision 1.30
diff -u -r1.30 transition_guide.texi
--- transition_guide.texi	1999/09/12 04:27:27	1.30
+++ transition_guide.texi	1999/11/11 23:28:05
@@ -149,7 +149,6 @@
 aditi_top_down  fx              500
 all             fxy             950
 and             xfy             720
-assertion       fx              1199
 div             yfx             400
 else            xfy             1170
 end_module      fx              1199
@@ -169,6 +168,7 @@
 or              xfy             740
 pragma          fx              1199
 pred            fx              800
+promise         fx              1199
 rule            fx              1199
 semipure        fy              800
 some            fxy             950
Index: library/ops.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/ops.m,v
retrieving revision 1.25
diff -u -r1.25 ops.m
--- ops.m	1999/07/13 08:54:52	1.25
+++ ops.m	1999/11/12 00:28:01
@@ -172,6 +172,7 @@
 ops__op_table("aditi_top_down", before, fx, 500). % Mercury extension
 ops__op_table("all", before, fxy, 950).		% Mercury/NU-Prolog extension
 ops__op_table("and", after, xfy, 720).		% NU-Prolog extension
+	% XXX assertion bootstrap
 ops__op_table("assertion", before, fx, 1199).	% Mercury extension
 ops__op_table("div", after, yfx, 400).		% standard ISO Prolog
 ops__op_table("else", after, xfy, 1170).	% Mercury/NU-Prolog extension
@@ -205,6 +206,7 @@
 ops__op_table("or", after, xfy, 740).		% NU-Prolog extension
 ops__op_table("pragma", before, fx, 1199).	% Mercury extension
 ops__op_table("pred", before, fx, 800).		% Mercury/NU-Prolog extension
+ops__op_table("promise", before, fx, 1199).	% Mercury extension
 ops__op_table("rem", after, xfx, 400).		% Standard ISO Prolog
 ops__op_table("rule", before, fx, 1199).	% NU-Prolog extension
 ops__op_table("semipure", before, fy, 800).	% Mercury extension

----
 +----------------------------------------------------------------------+
 | Peter Ross      M Sci/Eng Melbourne Uni                              |
 | petdr at cs.mu.oz.au  WWW: www.cs.mu.oz.au/~petdr/ ph: +61 3 9344 9158  |
 +----------------------------------------------------------------------+
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list