arrow-kt / arrow-fx

Λrrow Fx is part of Λrrow, a functional companion to Kotlin's Standard Library
http://arrow-kt.io
Other
64 stars 15 forks source link

Deprecate traverseN/sequenceN with Long and expose version with `Int` #324

Closed nomisRev closed 3 years ago

nomisRev commented 3 years ago

Reported by @satyamagarwal https://kotlinlang.slack.com/archives/C5UPMM0A0/p1607744044109800?thread_ts=1607681016.102800&cid=C5UPMM0A0

traverseN and sequenceN currently use Long, but the Semaphore of KotlinX only supports Int. Convereting Int to Long may cause a bug. We should deprecate the Long variant and offer an Int variant instead. Perhaps temporarly we could add a validation to check if Long doesn't overflow when converting to Int to prevent user bugs. (https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#toIntExact-long-)

https://github.com/arrow-kt/arrow-fx/pull/317/files#diff-2776865a3044312b95b004b18c9d4d1d1565ae171163b2ab1e062000b16d5ef8R38

nomisRev commented 3 years ago

Closed in #331