[m-dev.] for review: Aditi update round 2 [1]

Simon Taylor stayl at cs.mu.OZ.AU
Mon Jul 5 13:55:40 AEST 1999


> 
> On 02-Jul-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> >  compiler/mercury_to_mercury.m:
> >  	Add unary prefix operators `aditi_bottom_up' and `aditi_top_down',
> >  	used as qualifiers on lambda expressions.
> > +	Add infix operator `==>' to separate the tuples in an
> > +	`aditi_modify' call.
 
> Oh, I see you did actually modify ops.m, but I don't think you mentioned
> it in the log message.

`library/ops.m:' was the line above what you quoted (it didn't show up
in the relative diff). I've added the operators to doc/transition_guide.texi.


> > -	% Shared constant cells can be allocated in static data.
> > -	% Others must be created on the heap.
> > +	% Cells marked `cell_is_shared' can be allocated in read-only memory.
> > +	% Cells marked `cell_is_unique' must be writeable.
> 
> I suggest
> 
> 	% Cells marked `cell_is_shared' can be allocated in read-only memory,
> 	% and can be shared.
> 	% Cells marked `cell_is_unique' must be writeable, and therefore
> 	% cannot be shared.

OK.


--- compiler/make_hlds.m	1999/07/05 01:26:50	1.9
+++ compiler/make_hlds.m	1999/07/05 01:29:24
@@ -4914,8 +4914,15 @@
 aditi_update_arity_error(Context, UpdateStr, Arity, ExpectedArities) -->
 	io__set_exit_status(1),
 	{ MaybePredOrFunc = no },
-	report_error_num_args(yes, Context, MaybePredOrFunc,
-		unqualified(UpdateStr), Arity, ExpectedArities).
+	prog_out__write_context(Context),
+	io__write_string("Error: "),
+	{ MaybePredOrFunc = no },
+	report_error_num_args(MaybePredOrFunc, Arity, ExpectedArities),
+	io__nl,
+	prog_out__write_context(Context),
+	io__write_string("  in `"),
+	io__write_string(UpdateStr),
+	io__write_string("'.\n").
 
 	% Produce an invalid goal when parsing of an Aditi update fails.
 :- pred invalid_aditi_update_goal(string, list(prog_term), hlds_goal_info,
--- compiler/post_typecheck.m	1999/07/05 02:02:29	1.7
+++ compiler/post_typecheck.m	1999/07/05 02:02:45
@@ -525,13 +525,13 @@
 	;
 		io__set_exit_status(1),
 		prog_out__write_context(Context),
-		io__write_string("In call to "),
+		io__write_string("In "),
 		hlds_out__write_call_id(
 			generic_call(aditi_builtin(Builtin, CallId))
 		),
 		io__write_string(":\n"),
 		prog_out__write_context(Context),
-		io__write_string("  the modified "),
+		io__write_string("  error: the modified "),
 		{ pred_info_get_is_pred_or_func(PredInfo, PredOrFunc) },
 		hlds_out__write_pred_or_func(PredOrFunc),
 		io__write_string(" is not a base relation.\n")
--- compiler/typecheck.m	1999/07/05 01:24:41	1.7
+++ compiler/typecheck.m	1999/07/05 02:55:03
@@ -153,14 +153,15 @@
 :- mode typecheck__reduce_context_by_rule_application(in, in, in, in, in, out, 
 	in, out, in, out) is det.
 
-	% report_error_num_args(IsFirst, Context, MaybePredOrFunc,
-	%	SymName, Arity, CorrectArities).
-	% Report an error for a call with the wrong number of arguments.
-	% `IsFirst' should be `yes' if there are no previous lines in the
-	% error message.
-:- pred report_error_num_args(bool, term__context, maybe(pred_or_func),
-		sym_name, int, list(int), io__state, io__state).
-:- mode report_error_num_args(in, in, in, in, in, in, di, uo) is det.
+	% report_error_num_args(MaybePredOrFunc, Arity, CorrectArities).
+	%
+	% Write
+	% "wrong number of arguments (<Arity>; should be <CorrectArities>)",
+	% adjusting `Arity' and `CorrectArities' if `MaybePredOrFunc' is
+	% `yes(function)'.
+:- pred report_error_num_args(maybe(pred_or_func), int, list(int),
+		io__state, io__state).
+:- mode report_error_num_args(in, in, in, di, uo) is det.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -5028,19 +5029,18 @@
 		PredOrFunc - SymName/Arity, Arities) -->
 	write_context_and_pred_id(TypeCheckInfo),
 	{ typecheck_info_get_context(TypeCheckInfo, Context) },
-	report_error_num_args(no, Context, yes(PredOrFunc),
-		SymName, Arity, Arities).
-
-report_error_num_args(First, Context, MaybePredOrFunc,
-		SymName, Arity0, Arities0) -->
 	prog_out__write_context(Context),
-	(
-		{ First = yes },
-		io__write_string("Error: ")
-	;
-		{ First = no },
-		io__write_string("  error: ")
-	),
+	io__write_string("  error: "),
+	report_error_num_args(yes(PredOrFunc), Arity, Arities),
+	io__nl,
+	prog_out__write_context(Context),
+	io__write_string("  in call to "),
+	hlds_out__write_pred_or_func(PredOrFunc),
+	io__write_string(" `"),
+	prog_out__write_sym_name(SymName),
+	io__write_string("'.\n").
+
+report_error_num_args(MaybePredOrFunc, Arity0, Arities0) -->
 	io__write_string("wrong number of arguments ("),
 
 	% Adjust arities for functions.
@@ -5060,19 +5060,7 @@
 	io__write_int(Arity),
 	io__write_string("; should be "),
 	report_error_right_num_args(Arities),
-	io__write_string(")\n"),
-	prog_out__write_context(Context),
-	io__write_string("  in call to "),
-	(
-		{ MaybePredOrFunc = yes(PredOrFunc) },
-		hlds_out__write_pred_or_func(PredOrFunc),
-		io__write_string(" ")
-	;
-		{ MaybePredOrFunc = no }
-	),
-	io__write_string("`"),
-	prog_out__write_sym_name(SymName),
-	io__write_string("'.\n").
+	io__write_string(")").
 
 :- pred report_error_right_num_args(list(int), io__state, io__state).
 :- mode report_error_right_num_args(in, di, uo) is det.
@@ -5210,11 +5198,10 @@
 :- mode report_wrong_arity_constructor(in, in, in, in, di, uo) is det.
 
 report_wrong_arity_constructor(Name, Arity, ActualArities, Context) -->
-	io__write_string("  error: wrong number of arguments ("),
-	io__write_int(Arity),
-	io__write_string("; should be "),
-	report_error_right_num_args(ActualArities),
-	io__write_string(")\n"),
+	io__write_string("  error: "),
+	{ MaybePredOrFunc = no },
+	report_error_num_args(MaybePredOrFunc, Arity, ActualArities),
+	io__nl,
 	prog_out__write_context(Context),
 	io__write_string("  in use of constructor `"),
 	prog_out__write_sym_name(Name),
Index: doc/transition_guide.texi
===================================================================
RCS file: /home/staff/zs/imp/mercury/doc/transition_guide.texi,v
retrieving revision 1.27
diff -u -u -r1.27 transition_guide.texi
--- transition_guide.texi	1999/03/24 13:09:02	1.27
+++ transition_guide.texi	1999/07/03 23:49:23
@@ -134,6 +134,7 @@
 =               xfx             700
 =<              xfx             700
 ==              xfx             700
+==>             xfx             1175
 =>              xfy             920
 >               xfx             700
 >=              xfx             700
@@ -144,6 +145,8 @@
 \=              xfx             700
 ^               xfy             200
 ~               fy              900
+aditi_bottom_up fx              500
+aditi_top_down  fx              500
 all             fxy             950
 and             xfy             720
 div             yfx             400
Index: library/ops.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/ops.m,v
retrieving revision 1.23
diff -u -u -r1.23 ops.m
--- ops.m	1998/03/03 17:26:02	1.23
+++ ops.m	1999/07/03 23:52:18
@@ -116,6 +116,8 @@
 ops__lookup_op(_OpTable, Name) :-
 	ops__op_table(Name, _, _, _).
 
+	% Changes here may require changes to compiler/mercury_to_mercury.m
+	% and doc/transition_guide.texi.
 :- pred ops__op_table(string, ops__category, ops__specifier, ops__priority).
 :- mode ops__op_table(in, in, out, out) is semidet.
 :- mode ops__op_table(in, out, out, out) is nondet.

--- tests/invalid/aditi_update_errors.err_exp	1999/07/05 01:37:23	1.3
+++ tests/invalid/aditi_update_errors.err_exp	1999/07/05 01:38:02
@@ -1,12 +1,12 @@
 aditi_update_errors.m:118: Error: wrong number of arguments (5; should be 3 or 4)
-aditi_update_errors.m:118:   in call to `aditi_modify'.
+aditi_update_errors.m:118:   in `aditi_modify'.
 aditi_update_errors.m:117: Error: expected
 aditi_update_errors.m:117:   `aditi_modify(
 aditi_update_errors.m:117:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
 aditi_update_errors.m:117:     DB0, DB)'
 aditi_update_errors.m:117:   or `aditi_modify(PredOrFunc p/N, Closure, DB0, DB)'.
 aditi_update_errors.m:108: Error: wrong number of arguments (5; should be 3 or 4)
-aditi_update_errors.m:108:   in call to `aditi_modify'.
+aditi_update_errors.m:108:   in `aditi_modify'.
 aditi_update_errors.m:107: Error: expected
 aditi_update_errors.m:107:   `aditi_modify(
 aditi_update_errors.m:107:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
@@ -18,10 +18,10 @@
 aditi_update_errors.m:098:     DB0, DB)'
 aditi_update_errors.m:098:   or `aditi_modify(PredOrFunc p/N, Closure, DB0, DB)'.
 aditi_update_errors.m:094: Error: wrong number of arguments (5; should be 4)
-aditi_update_errors.m:094:   in call to `aditi_bulk_delete'.
+aditi_update_errors.m:094:   in `aditi_bulk_delete'.
 aditi_update_errors.m:093: Error: expected `PredOrFunc Name/Arity' in call to `aditi_bulk_delete'.
 aditi_update_errors.m:084: Error: wrong number of arguments (5; should be 4)
-aditi_update_errors.m:084:   in call to `aditi_bulk_delete'.
+aditi_update_errors.m:084:   in `aditi_bulk_delete'.
 aditi_update_errors.m:083: Error: expected `PredOrFunc Name/Arity' in call to `aditi_bulk_insert'.
 aditi_update_errors.m:075: Error: expected `aditi_delete((p(<Args>) :- <Goal>), DB0, DB)'
 aditi_update_errors.m:075:   or `aditi_delete(PredOrFunc p/N, Closure, DB0, DB)'.
@@ -32,9 +32,9 @@
 aditi_update_errors.m:063: Error: expected `aditi_delete((p(<Args>) :- <Goal>), DB0, DB)'
 aditi_update_errors.m:063:   or `aditi_delete(PredOrFunc p/N, Closure, DB0, DB)'.
 aditi_update_errors.m:061: Error: wrong number of arguments (4; should be 3)
-aditi_update_errors.m:061:   in call to `aditi_insert'.
+aditi_update_errors.m:061:   in `aditi_insert'.
 aditi_update_errors.m:060: Error: wrong number of arguments (4; should be 3)
-aditi_update_errors.m:060:   in call to `aditi_insert'.
+aditi_update_errors.m:060:   in `aditi_insert'.
 aditi_update_errors.m:058: Error: expected tuple to insert in call to `aditi_insert'
 aditi_update_errors.m:100: In clause for predicate `aditi_update_errors:aditi_update_syntax/2':
 aditi_update_errors.m:100:   warning: variable `X' has overlapping scopes.
--------------------------------------------------------------------------
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