[m-rev.] for review: document inst var scoping

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Oct 28 21:18:21 AEDT 2002


Branches: main Estimated hours taken: 0.5

doc/reference_manual.texi:
	Document the scoping rules for inst variables.

Workspace: /home/ceres/fjh/ws-ceres2/mercury
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.259
diff -u -d -r1.259 reference_manual.texi
--- doc/reference_manual.texi	1 Oct 2002 08:13:26 -0000	1.259
+++ doc/reference_manual.texi	28 Oct 2002 10:17:14 -0000
@@ -1442,16 +1442,28 @@
 @node Variable scoping
 @section Variable scoping
 
-Variables occurring in data-terms, other than in the right-hand
-(@var{Type}) operand of an explicit type qualification,
-are called ordinary variables,
-while variables occurring in types are called type variables.
-Type variables and ordinary variables occupy different namespaces:
-there is no semantic relationship between a type variable and
-an ordinary variable even if they happen to share the same name.
+There are sorts of variables in Mercury: ordinary variables,
+type variables, and inst variables.
+
+Variables occurring in types are called type variables.
+Variables occurring in insts or modes are called inst variables.
+Variables that occur in data-terms,
+and that are not inst variables
+or type variables, are called ordinary variables.
+
+(Type variables can occur in data-terms in the right-hand [@var{Type}]
+operand of an explicit type qualification.
+Inst variables can occur in data-terms in the right-hand [@var{Mode}]
+operand of an explicit mode qualification.  Apart from that,
+all other variables in data-terms are ordinary variables.)
+
+The three different variables sorts occupy different namespaces:
+there is no semantic relationship between two variables of different sorts
+(e.g. a type variable and an ordinary variable) even if they happen to
+share the same name.
 (However, as a matter of programming style, it is generally a
-bad idea to use the same name for both a type variable and
-an ordinary variable in the same clause.)
+bad idea to use the same name for variables of different sorts
+in the same clause.)
 
 The scope of ordinary variables is the clause or declaration in which
 they occur, unless they are quantified, either explicitly
@@ -1467,6 +1479,9 @@
 type variables. The scope of any type variables in an explicit
 type qualification which do not occur in the predicate or function's
 type declaration is the clause in which they occur.
+
+The scope of inst variables is the clause or declaration in which
+they occur.
 
 @node Implicit quantification
 @section Implicit quantification

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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