Commits

camlspotter  committed 7ffe8bb

now compiles!

  • Participants
  • Parent commits b5b508d
  • Branches dev

Comments (0)

Files changed (1)

File oowrap/oowrap.ml

       in
 
       let methods = List.fold_left (fun st x -> CrSem(_loc, st, x)) <:class_str_item<>> methods in
-      let sitem = <:str_item< 
-                  class $lid:clsname$ t : M.$lid:clsname$ = object 
-                      $inherits$
-                      $unwrap$
-                      $methods$ 
-                  end >> in
+      let sitem = 
+        <:str_item< 
+           class $lid:clsname$ t : M.$lid:clsname$ = object 
+               $inherits$
+               $unwrap$
+               $methods$ 
+           end 
+           let _ = $lid: "new_" ^ clsname$ := new $lid:clsname$
+        >> 
+      in
 
       let cltype = CtEq(_loc, 
                         CtCon(_loc, ViNil, <:ident< $lid:clsname$ >>, <:ctyp<>>),
       (           
         (tyname, sitem, cltype) :: clses,
 
-        <:str_item< $st$ module $modname$ = struct $sitems$ end >>
+        <:str_item< 
+          $st$ 
+          module $modname$ = struct 
+            module Type = OPyType (* To avoid name space collisions with Python's Type module *)
+            $sitems$ 
+          end 
+        >>
       ) ) modules ([], <:str_item<>>)
 
   let build class_dep_graph modules =
 
     let news =
       List.fold_left (fun st (tyname, _, _) ->
-        <:str_item< $st$ 
-                    let $lid: "new_o" ^ tyname$ = ref (fun _ -> assert false) >>) <:str_item<>> clses
+        <:str_item< 
+            $st$ 
+            let $lid: "new_o" ^ tyname$ : ( $lid:tyname$ t -> M.$lid: "o" ^ tyname$ ) ref = ref (fun _ -> assert false) >>) <:str_item<>> clses
     in
 
     (* create structure of classes in the order of dependency *)
 
     <:str_item< 
       open Type;;
-      module Type = Type;;
+      module OPyType = Type (* To avoid name space collisions with Python's Type module *)
       module Py = Api.Py;;
       let option_map v f = match v with 
         | Some v -> Some (f v)