Ephemeron.Kn.Make(3)
okay so bestie, this page is Ephemeron.Kn.Make(3) from the OCaml library manual β and it's giving weak hash table functor realness, no cap π
β¨
π NAME π
Ephemeron.Kn.Make β functor building an implementation of a weak hash table. periodt.
π§ Module π§
Module Ephemeron.Kn.Make π«Ά
β¨ Documentation β¨
πΈ Module Make πΈ
here's the exact module shape:
Module Make
: (H : Hashtbl.HashedType) -> sig end
Functor building an implementation of a weak hash table. iconic behavior, honestly.
Parameters:
HβStdlib.Hashtbl.HashedType
The vibe here: it proposes the same interface as a usual hash table. But β and this is the big weak-table caveat β since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two. π«
π¨ bestie, do not forget that caveat. weak bindings + GC timing =find h kcan absolutely raiseNot_foundaftermem h ksaid true. that's the documented behavior, not a drill. π
Here are the types and the full val lineup, exact signatures and all:
type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
and the last two, with their notes:
val clean : 'a t -> unitβ remove all dead bindings. Done automatically during automatic resizing.val stats_alive : 'a t -> Hashtbl.statisticsβ same asHashtbl.SeededS.statsbut only count the alive bindings.
that's the whole page, bestie π«Ά the footer energy is OCamldoc, dated 2026-06-22 β official manual sign-off, cute and done πβ¨
π¦ where this page comes from
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms