[m-rev.] Relax solver type definition syntax

Ralph Becket rafe at cs.mu.OZ.AU
Fri Mar 11 16:43:28 AEDT 2005


Estimated hours taken: 0.5
Branches: main, release

compiler/prog_io.m:
doc/reference_manual.texi:
	Make the `ground is ...' and `any is ...' attributes optional in solver
	type definitions, defaulting to `ground' if absent.

	Reflect this change in the documentation.

Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.237
diff -u -r1.237 prog_io.m
--- compiler/prog_io.m	10 Mar 2005 02:35:59 -0000	1.237
+++ compiler/prog_io.m	11 Mar 2005 05:07:50 -0000
@@ -2035,16 +2035,28 @@
 				WhereTerm)
 		)
 	;
-		IsSolverType = solver_type
+		IsSolverType = solver_type,
 	->
 		(
 			RepresentationIsResult = ok(yes(RepnType)),
 			InitialisationIsResult = ok(yes(InitPred)),
-			GroundIsResult         = ok(yes(GroundInst)),
-			AnyIsResult            = ok(yes(AnyInst)),
+			GroundIsResult         = ok(MaybeGroundInst),
+			AnyIsResult            = ok(MaybeAnyInst),
 			EqualityIsResult       = ok(MaybeEqPred),
 			ComparisonIsResult     = ok(MaybeCmpPred)
 		->
+			(
+				MaybeGroundInst = yes(GroundInst)
+			;
+				MaybeGroundInst = no,
+				GroundInst = ground_inst
+			),
+			(
+				MaybeAnyInst = yes(AnyInst)
+			;
+				MaybeAnyInst = no,
+				AnyInst = ground_inst
+			),
 			MaybeSolverTypeDetails = yes(solver_type_details(
 				RepnType, InitPred, GroundInst, AnyInst)),
 			(
@@ -2058,10 +2070,18 @@
 			),
 			Result = ok(MaybeSolverTypeDetails, MaybeUnifyCompare)
 		;
-			Result = error("missing solver type attribute: " ++
-				"required solver type attributes are " ++
-				"`representation', `initialisation', " ++
-				"`ground', and `any'", WhereTerm)
+			RepresentationIsResult = ok(no)
+		->
+			Result = error("solver type definitions must have a" ++
+				"`representation' attribute")
+		;
+			InitialisationIsResult = ok(no)
+		->
+			Result = error("solver type definitions must have an" ++
+				"`initialisation' attribute")
+		;
+			error("prog_io__make_maybe_where_details: " ++
+				"shouldn't have reached this point! (1)")
 		)
 	;
 		% Here we know IsSolverType = non_solver_type, so...
@@ -2081,7 +2101,7 @@
 		Result = ok(no, yes(unify_compare(MaybeEqPred, MaybeCmpPred)))
 	;
 		error("prog_io__make_maybe_where_details: " ++
-			"shouldn't have reached this point!")
+			"shouldn't have reached this point! (2)")
 	).
 
 	% get_determinism(Term0, Term, Determinism) binds Determinism
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.309
diff -u -r1.309 reference_manual.texi
--- doc/reference_manual.texi	10 Mar 2005 02:36:02 -0000	1.309
+++ doc/reference_manual.texi	11 Mar 2005 05:29:26 -0000
@@ -2161,11 +2161,11 @@
                 comparison     is comparison_pred.
 @end example
 
-The first four attributes after the @samp{where} are mandatory
-(@samp{initialization} is allowed as a synonym for
- at samp{initialisation}), the equality and comparison attributes are
-optional (although a solver type without equality would not be very
-useful), and attributes must appear in the order shown.
+The @samp{representation} and @samp{initialisation} attributes are mandatory
+(@samp{initialization} is allowed as a synonym for @samp{initialisation}),
+ at samp{ground_inst} and @samp{any_inst} default to @samp{ground}, the equality
+and comparison attributes are optional (although a solver type without equality
+would not be very useful), and attributes must appear in the order shown.
 
 The @code{representation_type} is the type used to implement the
 @code{solver_type}.  A two-tier scheme of this kind is necessary for a
--------------------------------------------------------------------------
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