-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove IOLocal#scope
, revert #3214
#3405
Conversation
I have incidentally talked myself into it being fine. There are pointy bits, but I think the behavior is correct according to spec, and there are lots of other pointy bits. Why not remove I agree that higher-level APIs are needed for safe use. #3385 is excellent for "static monadic regions", but not up to the task of "dynamic monadic regions", to borrow terms from #634. I'm still pursuing that holy grail for otel4s. |
Is it? It says this.
There's no way it can guarantee this, without guaranteeing that it can run those on the same fiber. Which it cannot, because |
Okay, that's fair. But Stream gets into trouble not by calling |
Yes, but whose job is it to use correctly? If I compose my |
The problem is, that even if Which is why this API doesn't work: to deliver what it promises, it relies on behavior which is not guaranteed. |
That's fair. FS2 is using |
I think there are enough footguns here that I'd rather err on the side of caution. We can always bring it back in a later release. |
@djspiewak @rossabaker Would going back to the originally proposed implementation using bracket dodge the issues with how the |
@wunderk1nd-e thanks for chiming in! Yes, I believe that would address the issues, since the acquire and release phases of |
Reverts #3214, with apologies to @iRevive. IIRC I even encouraged that PR, so my bad.
Basically, for
scope
to work correctly, theacquire
andrelease
effects must run on the same fiber.Resource
cannot guarantee this, so IMO it's a leaky abstraction. Furthermore Ross and I demonstrated various weird/surprising behaviors when mixed with other combinators starting from #3360 (comment).So yeah, I feel very unsure about exposing an API like this now. If we want to offer "higher-level" APIs that can be used safely, my vote is for something like #3385.