Add Eio_unix.Stdenv.with_env for updating environments #823
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.