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
scopeto work correctly, theacquireandreleaseeffects must run on the same fiber.Resourcecannot 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.