diff: deprecate old-style lambda expressions

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Mar 24 16:13:48 AEDT 1999


On 16-Mar-1999, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> On Tue, Mar 16, 1999 at 03:27:03PM +1100, Peter Ross wrote:
> > While we are removing Prolog support, should we also not remove
> > the lamda notation for higher order terms?
> 
> I think that's rather a different issue, and in this case I don't see
> a good argument for removing it without plenty of forewarning.  Maybe
> 0.9 should declare that that syntax will be phased out.  Ideally, then,
> in the next release (1.0?) the compiler would print warnings for use
> of that feature and then finally 1.1 would remove it altogether.

Yes, I agree.

--------------------

Estimated hours taken: 0.25

Deprecate the old style of lambda expressions.

NEWS:
	Mention that the old-style lambda expressions are now deprecated.

doc/reference_manual.texi:
	Document that the old-style lambda expressions are now deprecated.
	Update the documentation to always use new-style lambda expressions
	rather than old-style lambda expressions in the examples.

compiler/notes/todo.html:
	Mention that we should warn about the use of old-style lambda
	expressions.

Index: NEWS
===================================================================
RCS file: /home/mercury1/repository/mercury/NEWS,v
retrieving revision 1.138
diff -u -r1.138 NEWS
--- NEWS	1999/03/18 11:09:39	1.138
+++ NEWS	1999/03/24 04:58:32
@@ -29,6 +29,13 @@
   predicate argument and unify it with the compound term in the body of
   the lambda expression.
 
+* The old-style syntax for predicate lambda expressions,
+  `lambda([<Args>] is <Det>, <Goal>)', is now officially deprecated.
+
+  Please use the new syntax-style `(pred([<Args>]) is <Det> :- <Goal>)'
+  instead.  The compiler still supports the old-style syntax, but
+  we plan to eventually drop this support in some future release.
+
 Changes to the Mercury standard library:
 ****************************************
 
Index: compiler/notes/todo.html
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/notes/todo.html,v
retrieving revision 1.8
diff -u -r1.8 todo.html
--- todo.html	1998/09/22 08:04:17	1.8
+++ todo.html	1999/03/24 05:09:22
@@ -20,6 +20,15 @@
 
 <p>
 
+<h2> syntax </h2>
+
+<p>
+
+<ul>
+<li> Warn about the use of the deprecated old-style lambda expressions.
+
+</ul>
+
 <h2> type system </h2>
 
 <p>
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.132
diff -u -r1.132 reference_manual.texi
--- reference_manual.texi	1999/03/13 01:29:14	1.132
+++ reference_manual.texi	1999/03/24 05:06:57
@@ -718,7 +718,8 @@
 if @var{Goal} is true, then the expression has the meaning of
 @var{Expression1}, else the expression has the meaning of @var{Expression2}.
 
-A lambda expression is a compound term of one of the following forms
+A lambda expression (@pxref{Higher Order})
+is a compound term of one of the following forms
 
 @example
 lambda([Arg1::Mode1, Arg2::Mode2, @dots{}] is Det, Goal)
@@ -750,6 +751,9 @@
 but not in the arguments, the usual Mercury rules for implicit
 quantification apply (@pxref{Implicit quantification}).
 
+The form of lambda expression using @samp{lambda} as its top level functor
+is deprecated; please use the form using @samp{pred} instead.
+
 The form of lambda expression using @samp{-->} as its top level functor
 is a syntactic abbreviation: an expression of the form
 
@@ -2195,11 +2199,13 @@
 In the above example, the type of @samp{X}, @samp{Y}, and @samp{Z} is
 @samp{pred(list(int), int)}, which means a predicate of two
 arguments of types @samp{list(int)} and @samp{int} respectively.
-[The syntax using @samp{lambda} is supported to enable programs to work
-in both Mercury and Prolog, because the syntax using @samp{pred} and
- at samp{:-} can't be easily emulated in Prolog.  When we have implemented
-better debugging environments for Mercury, the syntax using @samp{lambda}
-will be deprecated.]
+
+The syntax using @samp{lambda} is deprecated;
+please use the syntax using @samp{pred} instead.
+[The syntax using @samp{lambda} was supported to enable programs to work
+in both Mercury and Prolog, because the syntax using @samp{pred} 
+can't be easily emulated in Prolog.  Now that we have implemented
+better debugging environments for Mercury, there is no need for this.]
 
 Similarly, given
 
@@ -2504,7 +2510,7 @@
 For example, given the definition of @samp{foo} above, the goal
 
 @example
-        foo(lambda([X::out] is det, X = 6))
+        foo((pred(X::out) is det :- X = 6))
 @end example
 
 @noindent
@@ -2513,7 +2519,7 @@
 the above goal could legally be written as
 
 @example
-        P = lambda([X::out] is det, X = 6),
+        P = (pred(X::out) is det :- X = 6),
         foo(Q),
         all [X] (call(P, X) <=> call(Q, X)).
 @end example

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list