Hashtbl when opening containers
Closed this issue · 6 comments
this is a FIXME in containers.ml. what is the best way to use CCHashtbl for now?
I didn't find how to expose an extension of Hashtbl
as Containers.Hashtbl
, because of sub-modules. However, you can still use CCHashtbl
directly:
let tbl = CCHashtbl.of_list [1, "1"; 2, "2"] in
Hashtbl.find tbl 1
or:
module H = CCHashtbl.Make(CCInt)
let tbl = H.of_list [1, "1"; 2, "2"]
ok, thanks. so when i use the specialized modules, (H
above) then these will include both the standard and CCHashtbl
functions?
Yes, the specialized module includes the signature Hashtbl.S
. In practice I do use specialized tables a lot :)
This should be solved, actually, there is a Hashtbl
module in Containers
since 0.14. But it's not 100% complete because of the sub-module clashes. If it's sufficient for you, can you close the issue?
i don't understand fully what sub-module clashes means here. if there is remaining unexpected behavior for the user maybe a hint in the docs would help. otherwise i think this is fine.
Actually, I might be able to fix it by breaking a bit compatibility (!!).
I will have to rename CCHashtbl.S
into CCHashtbl.FULL
(for example) and Make
into MakeFull
, so that include CCHashtbl
does not declare the module type S
and functor Make
twice.