Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That result library doesn’t look thread safe at all. I would be extremely cautious using it.


Author here. I have no idea what you could possibly mean with this comment. The coroutineBinding implementation correctly uses the coroutines API for parallel decomposition of Result bindings, exactly how the Kotlin Coroutines guide tells you to, backed by a Mutex[1]. The coroutineBinding isn't even the main selling point of the library, you can use it without using this feature entirely.

Please could you elaborate on what "looking thread safe" means to you? The only portion of the library that supports concurrency *is* thread safe - the unit tests[2] prove it and the use of concurrency primitives such as Kotlin's Mutex[3] are indicative of this.

I truly have no idea how you've judged the entirely of the library on whether it's "thread safe" when there is a single function (in an extension library, not the core one) that's related to concurrency and it is very clearly using concurrency primitives as intended.

With regards to "being cautious using it", you don't need to be. The maven central statistics suggest its being downloaded 300,000 times per month. If there was something wrong with it, it's likely somebody would have raised this already given how frequently the project has been adopted over the last seven years.

[1] https://github.com/michaelbull/kotlin-result/blob/master/kot...

[2] https://github.com/michaelbull/kotlin-result/blob/master/kot...

[3] https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-corout...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: