Skip to content

Conversation

@tleedjarv
Copy link
Contributor

More details in commit messages. In summary, there is a very real risk of breaking changes to the Digest module coming in future OCaml releases. Better prepare the code for those changes already today.

Compatibility with a range of compiler (and its standard library)
versions can in vast majority of cases be handled by writing code for
the oldest supported compiler version. Often times even breaking changes
can be handled by changing the code slightly, although in many cases
that means that older code will not be compatible with future compiler
releases.

This patch adds a simple mechanism for compatibility shims in the build
system for the rare cases when it is not possible or sufficient to write
single code covering all supported compiler (and standard library)
versions, including future versions.
The [Digest] module currently provides an implementation of the MD5
algorithm but this is implicit. Sub-modules for explicit algorithm
choice were introduced only starting with OCaml 5.2.0. There is a real
risk of the [Digest] module default algorithm in future being changed
to something other than MD5 (or the implicit default being removed
completely).

This patch makes the use of MD5 explicit to make the current code
compatible with future compiler releases should that change happen. This
patch has no effect when compiling with current compilers (or future
compilers if the default algorithm is not changed).
[Digest.MD5] was first added in OCaml 5.2.0. Luckily, the sub-module is
the same as the main [Digest] module in earlier OCaml releases.
@gdt gdt merged commit f46ae07 into bcpierce00:master Oct 14, 2025
30 checks passed
@tleedjarv tleedjarv deleted the digest branch October 14, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants