Add Eio_unix.Stdenv.with_env for updating environments#823
Add Eio_unix.Stdenv.with_env for updating environments#823patricoferris wants to merge 1 commit intoocaml-multicore:mainfrom
Conversation
I, too, miss the objects. |
|
This function seems reasonable to me, though not sure about the name. Maybe sometime like let env =
Eio_unix.Stdenv.override env
~process_mgr:(debug_process_mgr env#process_mgr)
in |
I don't mind (someone else doing it), but it's a big change to do after releasing 1.0 and might restart a load of arguments. Though I think perhaps the people saying they wouldn't use Eio if it used objects didn't use it anyway. Would need to survey Eio users to see what they think about it (normally the only people making a noise are the ones who don't like the current state, and the happy users keep quiet). |
An increasingly popular style of using Eio is the following.
Instead of passing individual capabilities around, programs now define a environment that is a subtype of
Eio_unix.Stdenv.t. For example, in Shelter I have:which is passed around internally carving out only the pieces I need in the right places. I ran into some bugs yesterday and I wanted to make full use of this capability-style and modify the process manager to print the args before spawning a child process.
At this point I just needed a way to update my
envto use this debugger process manager, which with this function would be simple!As an aside, I do wonder if it might be time to reconsider going back to objects for Eio's resources? The ergonomics, I think, are far superior to the
Eio.Resource.TAPI.