camlspotter avatar camlspotter committed f06897d

name space improvement

Comments (0)

Files changed (5)

 name = "OPyCaml"
-version = "1.0.0"
+version = "1.1.0"
 description = "( ゚∀゚)o彡°O'PyCaml"
 
 requires = ""
-module OPy = struct
-  include OOApiauto
-end
+module OPy = OOApiauto
+include OOApiauto.M
 
 open OPy
 module Slice = Slice

examples/testoo.ml

 
   let res = Object.callObject (Callable.coerce capitalize) [lowercase] in
 
-  (* String class is not accessible by String but OPy.String, in order
-     to avoid the name space collision with String in OCaml standard
-     library. *)
   prerr_endline (OPy.String.coerce res)#asString;
 
   Base.finalize ()

js_of_ocaml/opy_of_ocaml.ml

 open Opycaml.OOApi
-
-module OT = Opycaml.Type
+open OPy
 
 module Js : sig
   type 'a t
   type 'a gen_prop
   type 'a readonly_prop = < get : 'a> gen_prop
   type 'a meth
-  val dict : #OPy.o_Dict -> 'a t
+  val dict : #o_Dict -> 'a t
   module Unsafe : sig
     val get : 'a t -> string -> 'b
-    val meth_call : 'a t -> string -> #OPy.o_Object array -> 'b
-    val inject : #OPy.o_Object -> OPy.o_Object
+    val meth_call : 'a t -> string -> #o_Object array -> 'b
+    val inject : #o_Object -> o_Object
   end
 end = struct
-  type 'a t = OPy.o_Dict
+  type 'a t = o_Dict
   type 'a gen_prop
   let dict = Obj.magic
   module Unsafe = struct
     let get (o : 'a t) name = Obj.magic (o#getItemString name)
-    let meth_call (o : OPy.o_Dict) name args = 
+    let meth_call (o : o_Dict) name args = 
       Obj.magic (Object.callObject (Callable.coerce (o#getItemString name)) (Array.to_list args ))
     let inject = Obj.magic
   end

js_of_ocaml/testoo.ml

 open Opy_of_ocaml
 
 class type module_string = object
-  method lowercase  : OPy.o_String Js.readonly_prop
-  method capitalize : #OPy.o_String -> OPy.o_String Js.meth
+  method lowercase  : o_String Js.readonly_prop
+  method capitalize : #o_String -> o_String Js.meth
 end
 
 let import_module_dict name = Js.dict (Import.importModule name)#getDict
   let lowercase = module_string##lowercase in
   let res = module_string##capitalize( lowercase ) in
 
-  (* String class is not accessible by String but OPy.String, in order
-     to avoid the name space collision with String in OCaml standard
-     library. *)
   prerr_endline res#asString;
 
   Base.finalize ()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.