Conversation
No modules are needed in the library for OCaml 4.07.0+, which is a problem on MSVC since no .lib file is generated by ocamlopt -a when no modules are given. This is worked around by duplicating the Pervasives module.
|
I get a bad feeling about adding a toplevel |
|
I debated that too - what I dislike about it is that if two libraries were to use that trick then you'd be unable to link with both of them, and that seemed the more likely of two very unlikely possibilities (the other being some weird kind of errror we've not considered). Given that the raison d'etre of this library is to stop using The fix if someone manages to find a convincing breaking pattern would also be really quick (that's not an argument in favour of either solution, just that if anything does break, we can fix it) What do you think? |
|
Seems fine to me, let's get this merged and released! |
CHANGES: - Remove things accidentally included in 0.2.0 not listed below! (@dra27, ocaml/stdlib-shims#13) - Extend the fix in ocaml/stdlib-shims#12 to OCaml 4.10.0, since PR#9011 wasn't merged until 4.11
This should fix #11. Although with the library will be build with ocaml/dune#2693, OCaml 4.07-4.09 can't use the resulting
stdlib_shims.cmxafile without ocaml/ocaml#9011 which will require at least OCaml 4.10.0, so a workaround is needed here too.The workaround I've attempted is to duplicate the
Pervasivesmodule. This has the immediate effect of allowing the deprecation warning from 4.08.0 to be changed so that the stdlib-shims library is not recursively mentioned. On OCaml 4.07 this has no effect (cf. ocaml/ocaml#2041 in 4.08.0), so OCaml 4.07.0 doesn't gain the deprecation warning.The purpose of this library is to provide compatibility with
Stdlibfor OCaml < 4.07.0. In those versions, it's virtually possible to define a module calledPervasives(that's the purpose of ocaml/ocaml#1010), so if a user usesstdlib-shimsthen they have already opted out of being able to shadow standard library modules, and the inclusion of our ownpervasives.cmiis - I think - safe. It's also the case that if you're using this library, you're meant to be avoiding usingPervasivescompletely.