dbuenzli / fmt

OCaml Format pretty-printer combinators
http://erratique.ch/software/fmt
ISC License
71 stars 26 forks source link

Consider dropping the unix dependency #51

Closed hhugo closed 3 years ago

hhugo commented 3 years ago

As far as I can see, Fmt only depends on unix for its isatty feature. The ocaml runtime has caml_sys_isatty which is what you want. It is used in the compiler but not exported in the Stdlib. Maybe it should.

dbuenzli commented 3 years ago

Does it pose a particular problem to you ? Formally the fmt library does not depend on unix, only fmt.tty does.

The ocaml runtime has caml_sys_isatty which is what you want. It is used in the compiler but not exported in the Stdlib. Maybe it should.

Can't dig out the discussion but I think there was agreement when it was introduced that it would not.

hhugo commented 3 years ago

I discovered this Unix dependency while working on https://github.com/mirage/alcotest/pull/326 because of a missing primitives in jsoo needed for Unix.descr_of_out_channel on windows. It is fixed in https://github.com/ocsigen/js_of_ocaml/commit/0687e19072d11d038790f62e1d3bcdb181494980.

This is not blocking me right now, I've just opened the issue because I saw an opportunity to reduce the set of dependencies.

dbuenzli commented 3 years ago

I'm not too keen to depend on primitives that are not publicly exposed.

hhugo commented 3 years ago

I'll let you decide what to do with this issue then.

dbuenzli commented 3 years ago

I don't mind dropping the dependency if the primitive gets exposed in the stdlib (it would also certainly be very useful for cmdliner). So you know what to do now ;–)

dbuenzli commented 3 years ago

(Also I'm willing to use the primitive as soon as it gets clear that it will be exposed in the stdlib)