-
Notifications
You must be signed in to change notification settings - Fork 469
Successfully sun-setting the bigarray package #5494
Description
#5420/#5421 removes the internal definition of the bigarray package for OCaml 5.0+. This is of course correct, but it's proving a little painful for ecosystem testing, and this issue explores a possible halfway house.
There is a bug - albeit a very academic one - in the handling of the internal dummy packages. If you have a compiler with 4.08-4.14 configured with --disable-bigarray-lib and you do not install ocamlfind, then a library which includes bigarray in its libraries field will successfully compile (because the dummy package is used by Dune) but the META file for that library will incorrectly include bigarray in the requires field.
The dual of this behaviour is what I think is really wanted for OCaml 5.0+ in Dune. I'd like to suggest two tweaks in both 2.9.x and 3.x:
- In OCaml 5.0+ switches, the
bigarraypackage is a no-op, rather than a dummy. That is to say that(libraries bigarray)is effectively ignored - most importantly, it doesn't get emitted in therequiresfield inMETA. - In cases where Dune can determine that the package requires OCaml 4.07 or later, a deprecation warning should be emitted if
bigarrayappears in thelibrariesfield.
The first change would allow code targeting both OCaml 4.06 and earlier and OCaml 5.0+ to continue specifying bigarray. This is what's hurting ecosystem testing at the moment - we have packages which are breaking solely because of the metadata problem, but in fact build successfully in both 4.x and 5.x.
The second - optional - change encourages an ending to all this (and could also be accompanied by similar support on the opam/opam-dune-lint side) by ensuring that code targeting only OCaml 4.07 and later removes the reference to this unnecessary package and leads us towards a day where it's no longer referenced at all.
The alternatives aren't quite as pretty:
- packages using
Bigarraycould required to target only 4.07+ but, crucially, this requires new releases of those packages for 5.0 to remove the reference tobigarrayin thedunefiles (there do appear to be packages which otherwise do not require new releases, so it's that which is unfortunate, rather than forcing a 4.07 minimum version of OCaml) ocamlfindcould install a dummybigarraypackage for OCaml 5.0+ (i.e. as forbytes). However, this introduces a hard build-time dependency onocamlfindand also has no sunset.