[m-rev.] diff: remove support for deprecated syntax

Julien Fischer juliensf at cs.mu.OZ.AU
Mon Sep 12 14:41:01 AEST 2005


Estimated hours taken: 0.5
Branches: main

Remove supported for deprecated syntax.  The syntax removed is:

	- ':' as a module qualifier.
	- '::' and '->' for mode definitions.
	- the old-style pragma syntax.

The 0.12 release issues warnings for uses of this syntax.

XXX This also needs to be mentioned in the news file, but since I need to
clean up the main branch news file I'll do that as a separate change.

compiler/prog_io.m:
compiler/prog_io_pragma.m:
compiler/prog_io_util.m:
	Remove support for the syntax mentioned above.

	Break up an overlong line.

doc_reference_manual.texi:
	Remove the documentation for the above syntax.

Julien.

Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.247
diff -u -r1.247 prog_io.m
--- compiler/prog_io.m	12 Sep 2005 03:05:46 -0000	1.247
+++ compiler/prog_io.m	12 Sep 2005 04:15:47 -0000
@@ -1739,9 +1739,10 @@
 %-----------------------------------------------------------------------------%

 	% parse_mode_decl_pred(ModuleName, Pred, Condition, Result) succeeds
-	% if Pred is a predicate mode declaration, and binds Condition
-	% to the condition for that declaration (if any), and Result to
-	% a representation of the declaration.
+	% if Pred is a predicate mode declaration, and binds Condition to the
+	% condition for that declaration (if any), and Result to a
+	% representation of the declaration.
+	%
 :- pred parse_mode_decl_pred(module_name::in, varset::in, term::in,
 	decl_attrs::in, maybe1(item)::out) is det.

@@ -3169,7 +3170,7 @@
 %-----------------------------------------------------------------------------%

 	% parse a `:- mode p(...)' declaration
-
+	%
 :- pred process_mode(module_name::in, varset::in, term::in, condition::in,
 	decl_attrs::in, maybe(inst)::in, maybe(determinism)::in,
 	maybe1(item)::out) is det.
@@ -3444,17 +3445,13 @@

 	% Parse a `:- inst <InstDefn>.' declaration.
 	%
-	% `==' is the correct operator to use, although we accept
-	% `=' as well.  Since `=' was once the standard operator, make
-	% sure warnings are given before it is phased out.
-	%
 :- pred parse_inst_decl(module_name::in, varset::in, term::in,
 	maybe1(item)::out) is det.

 parse_inst_decl(ModuleName, VarSet, InstDefn, Result) :-
 	(
 		InstDefn = term__functor(term__atom(Op), [H, B], _Context),
-		( Op = "=" ; Op = "==" )
+		Op = "=="
 	->
 		get_condition(B, Body, Condition),
 		convert_inst_defn(ModuleName, H, Body, R),
@@ -3599,8 +3596,8 @@

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

-	% parse a `:- mode foo :: ...' or `:- mode foo = ...' definition.
-
+	% Parse a `:- mode foo == ...' definition.
+	%
 :- pred parse_mode_decl(module_name::in, varset::in, term::in, decl_attrs::in,
 	maybe1(item)::out) is det.

@@ -3616,31 +3613,10 @@
 			Result)
 	).

-	% People never seemed to remember what the right operator to use
-	% in a `:- mode' declaration is, so the syntax is accepted both
-	% `::' and `==', with `::' formerly the standard operator.
-	%
-	%	% Old syntax
-	% :- mode foo :: someinst -> someotherinst.
-	%
-	% But using `==' was a pain, because the precedence of `->' was
-	% too high.  We now accept `>>' as an alternative to `->', and
-	% `==' is now the standard operator to use in a `:- mode'
-	% declaration.  This is part of a long term plan to free up
-	% `::' as an operator so we can use it for mode qualification.
-	%
-	%	% New syntax
-	% :- mode foo == someinst >> someotherinst.
-	%
-	% We still support `::' in mode declarations for backwards
-	% compatibility, but it might be removed one day.
-	% Before phasing it out, a deprecated syntax warning should be
-	% given for a version or two.
-	%
 :- pred mode_op(term::in, term::out, term::out) is semidet.

 mode_op(term__functor(term__atom(Op), [H, B], _), H, B) :-
-	( Op = "==" ; Op = "::" ).
+	Op = "==".

 :- type processed_mode_body
 	--->	processed_mode_body(
@@ -4225,7 +4201,9 @@
 			\+ match_sym_name(ModName, DefaultModName)
 		->
 			term__coerce(Term, ErrorTerm),
-			Result = error("module qualifier in definition does not match preceding `:- module' declaration", ErrorTerm)
+			Result = error("module qualifier in definition " ++
+				"does not match preceding " ++ "
+				`:- module' declaration", ErrorTerm)
 		;
 			unqualify_name(SymName, UnqualName),
 			Result = ok(qualified(DefaultModName, UnqualName), Args)
@@ -4238,9 +4216,7 @@
 	(
 		Term = term__functor(term__atom(FunctorName),
 			[ModuleTerm, NameArgsTerm], _),
-		(	FunctorName = "."
-		;	FunctorName = ":"
-		)
+		FunctorName = "."
 	->
 		(
 			NameArgsTerm = term__functor(term__atom(Name), Args, _)
@@ -4253,12 +4229,12 @@
 				ModuleResult = error(_, _),
 				term__coerce(Term, ErrorTerm),
 				Result = error("module name identifier " ++
-					"expected before ':' in " ++
+					"expected before '.' in " ++
 					"qualified symbol name", ErrorTerm)
 			)
 		;
 			term__coerce(Term, ErrorTerm),
-			Result = error("identifier expected after ':' " ++
+			Result = error("identifier expected after '.' " ++
 				"in qualified symbol name", ErrorTerm)
 		)
 	;
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.86
diff -u -r1.86 prog_io_pragma.m
--- compiler/prog_io_pragma.m	5 Sep 2005 03:45:57 -0000	1.86
+++ compiler/prog_io_pragma.m	12 Sep 2005 04:08:45 -0000
@@ -54,7 +54,6 @@

 parse_pragma(ModuleName, VarSet, PragmaTerms, Result) :-
     (
-        % new syntax: `:- pragma foo(...).'
         PragmaTerms = [SinglePragmaTerm0],
         parse_type_decl_where_part_if_present(non_solver_type, ModuleName,
             SinglePragmaTerm0, SinglePragmaTerm, WherePartResult),
@@ -64,13 +63,11 @@
             VarSet, Result0)
     ->
         (
-                % The code to process `where' attributes will
-                % return an error result if solver attributes
-                % are given for a non-solver type.  Because
-                % this is a non-solver type, if the
-                % unification with WhereResult succeeds then
-                % _NoSolverTypeDetails is guaranteed to be
-                % `no'.
+            % The code to process `where' attributes will return an error
+            % result if solver attributes are given for a non-solver type.
+            % Because this is a non-solver type, if the unification with
+            % WhereResult succeeds then _NoSolverTypeDetails is guaranteed to
+            % be `no'.
             WherePartResult = ok(_NoSolverTypeDetails, MaybeUserEqComp),
             (
                 MaybeUserEqComp = yes(_),
@@ -94,15 +91,6 @@
             Result          = error(String, Term)
         )
     ;
-        % old syntax: `:- pragma(foo, ...).'
-        % XXX we should issue a warning; this syntax is deprecated.
-        PragmaTerms = [PragmaTypeTerm | PragmaArgs2],
-        PragmaTypeTerm = term__functor(term__atom(PragmaType), [], _),
-        parse_pragma_type(ModuleName, PragmaType, PragmaArgs2,
-            PragmaTypeTerm, VarSet, Result1)
-    ->
-        Result = Result1
-    ;
         fail
     ).

Index: compiler/prog_io_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_util.m,v
retrieving revision 1.37
diff -u -r1.37 prog_io_util.m
--- compiler/prog_io_util.m	5 Sep 2005 02:29:55 -0000	1.37
+++ compiler/prog_io_util.m	12 Sep 2005 04:15:02 -0000
@@ -271,25 +271,9 @@
 	convert_mode(AllowConstrainedInstVar, H0, H),
 	convert_mode_list(AllowConstrainedInstVar, T0, T).

-	%
-	% The new operator for mode declarations is >>.
-	% Previously we used ->, but this required a high-precedence
-	% operator such as :: for the :- mode delcaration.
-	%
-	% Using >> allows us to use == for the :- mode declaration.
-	%
-	% Eventually we can stop supporting :: and -> in :- mode
-	% declarations altogether.
-	%
 convert_mode(AllowConstrainedInstVar, Term, Mode) :-
 	(
-		(
-			Term = term__functor(term__atom(">>"),
-				[InstA, InstB], _)
-		;
-			Term = term__functor(term__atom("->"),
-				[InstA, InstB], _)
-		)
+		Term = term__functor(term__atom(">>"), [InstA, InstB], _)
 	->
 		convert_inst(AllowConstrainedInstVar, InstA, ConvertedInstA),
 		convert_inst(AllowConstrainedInstVar, InstB, ConvertedInstB),
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.324
diff -u -r1.324 reference_manual.texi
--- doc/reference_manual.texi	5 Sep 2005 02:29:56 -0000	1.324
+++ doc/reference_manual.texi	12 Sep 2005 04:23:13 -0000
@@ -2469,10 +2469,6 @@
 :- mode m == inst1 >> inst2.
 @end example

-It is also possible to write mode declarations using @code{::}
-and @code{->} instead of @code{==} and @code{>>} respectively,
-however this syntax is deprecated and may not be supported in future.
-
 Two standard shorthand modes are provided,
 corresponding to the standard notions of inputs and outputs:

@@ -4302,13 +4298,8 @@
 Uses of entities imported using @code{use_module} declarations
 @emph{must} be explicitly module qualified.

-Currently we also support @samp{__} and @samp{:} as alternative
-module qualifiers,
-so you can write @code{module__name} or @code{module:name} instead
-of @code{module.name}.
-We intend to change the use of @samp{:} to being a type
-qualifier instead in a future version, its use as a module qualifier
-is therefore deprecated.
+Currently we also support @samp{__} as an alternative module qualifier,
+so you can write @code{module__name} instead of @code{module.name}.

 Certain optimizations require information or source code for predicates
 defined in other modules to be as effective as possible.  At the moment,

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