I maintain a package that uses a function in Core.Unix. It expects this:
val socket : domain:socket_domain -> kind:socket_type -> protocol:int -> File_descr.t
as of core v0.14, the interface was extended to this:
val socket : ?close_on_exec:bool -> domain:socket_domain -> kind:socket_type -> protocol:int -> unit -> File_descr.t
My package won’t compile anymore. I need to throw a () onto the end of the
As a package maintainer I can do the easy thing, add the (), say it requires core >= v0.14, and everyone who isn’t ready to update has to learn about pinning packages.
That kinda sucks? IMO the ideal solution would be to conditionally compile based on what version of core is installed. If core >= v0.14, call socket with a trailing (). Otherwise leave it out.
Is there a way of portably achieving this conditional compilation with minimal cognitive/maintenance burden?