Available Hash Table APIs
The question is about which approach to constructing a hash table in Core is preferable.
I noticed that the JaneStreet’s Core Hashtbl library provides several interfaces to creating hash tables. Let’s assume that there’s no interest in polymorphic hash tables. Is there one approach that is most preferred? What is the role of Make
functor there? Is the use of this functor a preferred approach? It seems that the use of Key.Table
approach is referenced in earlier documentation, and I didn’t notice the presence of Make
functor in the earlier versions of the Hashtbl
. This suggests that maybe Make
functor based approach is a more recent method.
I know that in the base library the Make
-based approach has existed more or less from the beginning.
Given that, I don’t understand what the Hashtbl.create
is doing there, whence we already have other approaches taking equivalent record of functions. Is this a legacy method?
A couple of similar inquiries appeared on the forum here and here, but none had considered the issue of choosing an interface in the Core
.
There’s a type (_ , _, _) Hashtbl_intf.create_options_without_hashable
that emerges when a function create
in the module generated by the Make
is invoked. Now, this looks like a source of concern to me in the sense that hashable-based approach (and thus the Table
functor? Just like in the old Base
interface?) is suggested to be more normative rather.
Constructing Families of Hash Tables
If I would like to use hash tables that reference other hash tables (e.g. mapping from ids to property lists), is there a difference which interface I use as far as efficiency is concerned?