-
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
Relax Ref#access
semantics if set more than once
#2901
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At last
I'm not totally averse to this, since I think |
Does cats-effect/kernel/shared/src/main/scala/cats/effect/kernel/Ref.scala Lines 419 to 423 in 0a6bae2
|
I really can't think of a situation where we can't just use a Also fwiw, it surprises me that |
The reason
|
Ah that's super annoying. Also I'm not convinced it actually works since, if |
Hmm, actually isn't the same true of a |
Is it though? My argument in the linked discussion is exactly that this AtomicBoolean doesn't really enrich the semantics, even coming up with an example is challenging, can you think of some code that would want to reuse the |
I'm cool merging this once the conflicts are resolved. |
Why is it that something doesn't become officially "cool" until it conflicts 😝 |
I like to maximize the work involved. :-P |
Following a Discord discussion with @ChristopherDavenport and @SystemFw relating to the problem implementing
Ref#access
forMapRef
in #2464, here's a proposal to relax its semantics and thus remove the need for theAtomicBoolean
in its implementation. IIUC the impracticality of the implementation outweighs its benefits, which would only apply in rare circumstances when the setter is being used non-idiomatically.