ocaml-multicore / eio

Effects-based direct-style IO for multicore OCaml
Other
548 stars 66 forks source link

Add Condition to `Eio.Std` #580

Open anmonteiro opened 1 year ago

anmonteiro commented 1 year ago

I propose adding the Condition module to Eio.Std to avoid the ambiguity.

talex5 commented 1 year ago

I'm not very keen on that, since it does indeed shadow the stdlib module, which might be confusing.

SGrondin commented 1 year ago

At the moment I don't often open Eio.Std because I have to type "Eio." for ~90% of the Eio function calls I make anyway (Eio.Flow.*, Eio.Stream.*, Eio.Path.*, etc).

open Eio.Std is most useful for traceln, but during development I'm continuously adding and removing traceln calls while debugging, and since it's often the only usage of Eio.Std, it leads to intermittent and distracting warnings about an unused open.

I might change my workflow and start using open! instead.

To be clear, I'm not advocating for a change of direction in Eio.Std. I definitely see the advantages in the current direction. But I thought I should share this (minor) annoyance I deal with everyday in case it's useful to you all!

talex5 commented 1 year ago

One other possibility: you can add (flags (:standard -open Eio.Std)) in your dune file to open it for all modules. I only don't do that because it might confuse people copying my code as an example.