aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar whitequark <whitequark@whitequark.org>2018-06-21 02:34:33 +0000
committerGravatar whitequark <whitequark@whitequark.org>2018-06-21 04:54:34 +0000
commit0f6762ac80cc8d1f37918e9e8f0bb39692979630 (patch)
tree32f739968a88e9fd72feafce02c8d306c7944ec2
parent38c62ef2e9ce28370cd22aadab9d676ffb2bac56 (diff)
Rename Dyn.TParam→ValueS, Dyn.MapS.obj→value to clarify their purpose.
-rw-r--r--clib/dyn.ml27
-rw-r--r--clib/dyn.mli15
-rw-r--r--pretyping/geninterp.mli4
3 files changed, 24 insertions, 22 deletions
diff --git a/clib/dyn.ml b/clib/dyn.ml
index 7cdbf15a4..6c4576724 100644
--- a/clib/dyn.ml
+++ b/clib/dyn.ml
@@ -8,7 +8,7 @@
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
-module type TParam =
+module type ValueS =
sig
type 'a t
end
@@ -16,18 +16,18 @@ end
module type MapS =
sig
type t
- type 'a obj
type 'a key
+ type 'a value
val empty : t
- val add : 'a key -> 'a obj -> t -> t
+ val add : 'a key -> 'a value -> t -> t
val remove : 'a key -> t -> t
- val find : 'a key -> t -> 'a obj
+ val find : 'a key -> t -> 'a value
val mem : 'a key -> t -> bool
- type map = { map : 'a. 'a key -> 'a obj -> 'a obj }
+ type map = { map : 'a. 'a key -> 'a value -> 'a value }
val map : map -> t -> t
- type any = Any : 'a key * 'a obj -> any
+ type any = Any : 'a key * 'a value -> any
val iter : (any -> unit) -> t -> unit
val fold : (any -> 'r -> 'r) -> t -> 'r -> 'r
end
@@ -46,7 +46,8 @@ sig
type any = Any : 'a tag -> any
val name : string -> any option
- module Map(M : TParam) : MapS with type 'a obj = 'a M.t with type 'a key = 'a tag
+ module Map(Value : ValueS) :
+ MapS with type 'a key = 'a tag and type 'a value = 'a Value.t
end
module type S =
@@ -104,22 +105,22 @@ module Self : PreS = struct
let dump () = Int.Map.bindings !dyntab
- module Map(M : TParam) =
+ module Map(Value: ValueS) =
struct
- type t = Obj.t M.t Int.Map.t
- type 'a obj = 'a M.t
+ type t = Obj.t Value.t Int.Map.t
type 'a key = 'a tag
- let cast : 'a M.t -> 'b M.t = Obj.magic
+ type 'a value = 'a Value.t
+ let cast : 'a value -> 'b value = Obj.magic
let empty = Int.Map.empty
let add tag v m = Int.Map.add tag (cast v) m
let remove tag m = Int.Map.remove tag m
let find tag m = cast (Int.Map.find tag m)
let mem = Int.Map.mem
- type map = { map : 'a. 'a tag -> 'a M.t -> 'a M.t }
+ type map = { map : 'a. 'a tag -> 'a value -> 'a value }
let map f m = Int.Map.mapi f.map m
- type any = Any : 'a tag * 'a M.t -> any
+ type any = Any : 'a tag * 'a value -> any
let iter f m = Int.Map.iter (fun k v -> f (Any (k, v))) m
let fold f m accu = Int.Map.fold (fun k v accu -> f (Any (k, v)) accu) m accu
end
diff --git a/clib/dyn.mli b/clib/dyn.mli
index 7077e1d32..28dac5d6c 100644
--- a/clib/dyn.mli
+++ b/clib/dyn.mli
@@ -10,7 +10,7 @@
(** Dynamically typed values *)
-module type TParam =
+module type ValueS =
sig
type 'a t
end
@@ -18,18 +18,18 @@ end
module type MapS =
sig
type t
- type 'a obj
type 'a key
+ type 'a value
val empty : t
- val add : 'a key -> 'a obj -> t -> t
+ val add : 'a key -> 'a value -> t -> t
val remove : 'a key -> t -> t
- val find : 'a key -> t -> 'a obj
+ val find : 'a key -> t -> 'a value
val mem : 'a key -> t -> bool
- type map = { map : 'a. 'a key -> 'a obj -> 'a obj }
+ type map = { map : 'a. 'a key -> 'a value -> 'a value }
val map : map -> t -> t
- type any = Any : 'a key * 'a obj -> any
+ type any = Any : 'a key * 'a value -> any
val iter : (any -> unit) -> t -> unit
val fold : (any -> 'r -> 'r) -> t -> 'r -> 'r
end
@@ -47,7 +47,8 @@ sig
type any = Any : 'a tag -> any
val name : string -> any option
- module Map(M : TParam) : MapS with type 'a obj = 'a M.t with type 'a key = 'a tag
+ module Map(Value : ValueS) :
+ MapS with type 'a key = 'a tag and type 'a value = 'a Value.t
module Easy : sig
(* To create a dynamic type on the fly *)
diff --git a/pretyping/geninterp.mli b/pretyping/geninterp.mli
index fa522e9c3..606a6ebea 100644
--- a/pretyping/geninterp.mli
+++ b/pretyping/geninterp.mli
@@ -42,8 +42,8 @@ sig
end
-module ValTMap (M : Dyn.TParam) :
- Dyn.MapS with type 'a obj = 'a M.t with type 'a key = 'a Val.typ
+module ValTMap (Value : Dyn.ValueS) :
+ Dyn.MapS with type 'a key = 'a Val.typ and type 'a value = 'a Value.t
(** Dynamic types for toplevel values. While the generic types permit to relate
objects at various levels of interpretation, toplevel values are wearing