What I noticed and missed so far:
You should also mention in the release announcement, that the libraries were split up into specialised ones as you do in the video!
Also,
arrow.fx.coroutines.Atomic
, changed quite a lot but I couldn't find any advice for migration! 😔
e.g.
unsafe
and
modify
weren't deprecated, but do not exist in 2.0.
`unsafe`is easy as it can just be replaced by
invoke
.
But
modify
doesn't look like it has a in place replacement. :-/
a
Alejandro Serrano.Mena
12/08/2024, 5:15 PM
I definitely forgot atomic, but that transition happened some time ago...
anyway, instead of
sadly no...
with `modify`it was possible to return any other type, which we made use of in that case. I fixed it by copying the original modify from 1.2.4 as a extension function to our code base.
Copy code
fun <A, B> Atomic<A>.modify(f: (A) -> Pair<A, B>): B {
tailrec fun go(): B {
val a = this.get()
val (u, b) = f(a)
return if (!this.compareAndSet(a, u)) go() else b
}
return go()
}