… optims BatSplay uses a bit of type-checking magic to respect the Map interface (which requires map types to be covariant) while internally keeping a mutable reference for (inobservable) rebalancing mutations. The previous implementation is safe for the current versions of the OCaml compiler, but has the fundamental issue of mutating (through Obj magic) constructed values of a known-immutable type. The new implementation creates values at an immutable type, and then magically coerce them into the covariant immutable type. This ensures that the compiler knows (at value-creation time) that the allocated memory is *not* immutable -- this is the same technique we use for destination-passing-style lists. This trick of "covariant mutable references" can be isolated as a small submodule, which is then used (internally) throughout the BatSplay implementation. Thanks to Pierre Chambart for the discussion that led to this change.
…ew elements + minor indentation changes
…the previous key. This is the same semantics as Hashtbl.replace
…nly does one lookup if the key is already in the table. If the key is not found modify_opt calls add to add the key in order to ensure that the hashtbl is grown if needed.
…, filter_map"" Those functions should be available in NEXT_RELEASE.
…_map" Those new functions shall not get included in the 2.3.1 bugfix release.
The current semantics of "##V3##" is not "##V=3##" but "##V>=3##". This means that code with the following pattern ##V3## val foo : ... ##V4## external foo : ... would have both lines included when compiled under V>=4. To avoid this issue, we now explicitly use a comparison operator on all prefilters.