for review: update compiler_design.html

David Glen JEFFERY dgj at cs.mu.OZ.AU
Tue Mar 30 13:50:19 AEST 1999


Hi Fergus,

How does this look?

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

Estimated hours taken: 0.25

compiler/notes/compiler_design.html:
	Update the description of the check_typeclass phase to indicate
	that it:
		- comes before type checking
		- performs a source-to-source transformation to defer most
		  of the checking to later passes.
	Also delete mention of qualifying pred and func names in
	check_typeclass.m; all that work gets done by the later passes now.

----------------------------------------------------------------
Index: compiler_design.html
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/notes/compiler_design.html,v
retrieving revision 1.23
diff -u -t -r1.23 compiler_design.html
--- compiler_design.html	1998/12/07 05:27:51	1.23
+++ compiler_design.html	1999/03/30 03:46:04
@@ -136,8 +136,6 @@
           are module qualified during type checking.
         <li> predicate and function calls and constructors within goals 
           are module qualified during mode analysis.
-        <li> predicate and function names in typeclass instance declarations
-          are qualified in check_typeclass.m (after mode analysis).
         </ul>
  
 
@@ -206,6 +204,26 @@
         quantification.m handles implicit quantification and computes
         the set of non-local variables for each sub-goal
 
+<dt> checking typeclass instances (check_typeclass.m)
+        <dd>
+        check_typeclass.m both checks that instance declarations satisfy all 
+        the appropriate the superclass constraints and
+        performs a source-to-source transformation on the
+        methods methods from the instance declarations.
+        The transformed code is checked by type, mode, uniqueness, purity
+        and determinism correctness by the later passes, which has the effect
+        of checking the correctness of the instance methods themselves
+        (ie. that the instance methods match those expected by the typeclass
+        declaration).
+        During the transformation,
+        pred_ids and proc_ids are assigned to the methods for each instance. 
+
+        In
+        addition, while checking that the superclasses of a class are satisfied
+        by the instance declaration, a set of constraint_proofs are built up 
+        for the superclass constraints. These are used by polymorphism.m when
+        generating the base_typeclass_info for the instance.
+
 <dt> type checking
 
         <dd>
@@ -325,19 +343,6 @@
         Note that what unique_modes.m does is quite similar to
         what modes.m does, and unique_modes calls lots of predicates
         defined in modes.m to do it.
-
-<dt> checking typeclass instances (check_typeclass.m)
-        <dd>
-        check_typeclass.m checks that, each instance declaration, that the
-        types, modes and determinism of each predicate/function that is a
-        method of the class is correct (ie. that it matches the typeclass
-        declaration). This pass is performed at the end of semantic analysis
-        because it needs mode and determinism information. In this pass,
-        pred_ids and proc_ids are assigned to the methods for each instance. In
-        addition, while checking that the superclasses of a class are satisfied
-        by the instance declaration, a set of constraint_proofs are built up 
-        for the superclass constraints. These are used by polymorphism.m when
-        generating the base_typeclass_info for the instance.
 
 <dt> simplification (simplify.m)
 
----------------------------------------------------------------
----------------------------------------------------------------


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Homer, is this how you pictured
PhD student,                    |         married life?
Dept. of Comp. Sci. & Soft. Eng.|  Homer: Yup, pretty much... except we
The University of Melbourne     |         drove around in a van solving
Australia                       |         mysteries.



More information about the developers mailing list