diff options
| author | Pierre-Marie Pédrot | 2019-12-12 18:36:03 +0100 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2019-12-22 14:03:06 +0100 |
| commit | 1de15982dceaf28740f49f1d6cba61a5473656b0 (patch) | |
| tree | e2fef8a399f1fd1279acce59b5e42d15238479f4 /library | |
| parent | 9c75b6a6582620e2fb9a39c1ea1aa46a321af6a7 (diff) | |
Export the dynamic type API of libobjects.
Diffstat (limited to 'library')
| -rw-r--r-- | library/libobject.ml | 12 | ||||
| -rw-r--r-- | library/libobject.mli | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/library/libobject.ml b/library/libobject.ml index c9ea6bcff8..54c23ff2d5 100644 --- a/library/libobject.ml +++ b/library/libobject.ml @@ -92,14 +92,12 @@ let declare_object_full odecl = let na = odecl.object_name in let tag = Dyn.create na in let () = cache_tab := DynMap.add tag odecl !cache_tab in - let infun v = Dyn.Dyn (tag, v) in - let outfun v = match Dyn.Easy.prj v tag with - | None -> assert false - | Some v -> v - in - (infun,outfun) + tag -let declare_object odecl = fst (declare_object_full odecl) +let declare_object odecl = + let tag = declare_object_full odecl in + let infun v = Dyn.Dyn (tag, v) in + infun let cache_object (sp, Dyn.Dyn (tag, v)) = let decl = DynMap.find tag !cache_tab in diff --git a/library/libobject.mli b/library/libobject.mli index 146ccc293f..c83ad4086a 100644 --- a/library/libobject.mli +++ b/library/libobject.mli @@ -101,7 +101,9 @@ val ident_subst_function : substitution * 'a -> 'a will hand back two functions, the "injection" and "projection" functions for dynamically typed library-objects. *) -type obj +module Dyn : Dyn.S + +type obj = Dyn.t type algebraic_objects = | Objs of objects @@ -120,7 +122,7 @@ and objects = (Names.Id.t * t) list and substitutive_objects = Names.MBId.t list * algebraic_objects val declare_object_full : - 'a object_declaration -> ('a -> obj) * (obj -> 'a) + 'a object_declaration -> 'a Dyn.tag val declare_object : 'a object_declaration -> ('a -> obj) |
