https://kotlinlang.org logo
#coroutines
Title
# coroutines
l

louiscad

01/10/2018, 4:28 PM
Despite this being accidental, I think I'll take advantage of this until
nosuspend
or similar becomes a thing, to prevent accidental bad usage of the APIs I designed (to use
Bundle
on Android with properties on a shared
object
)
d

dave08

01/10/2018, 9:12 PM
I think a clearly kdoc'ed function is worth more than such a hack that might risk being "fixed" soon, people have been known to exclude libs dependencies to get higher versions of others to avoid issues with tons pf alrady written code... but I personally always ctl-q any fun I'm not sure about...
Although I agree it's tasty to find loopholes like this 🍔
l

louiscad

01/10/2018, 10:19 PM
Of course a proper KDoc is important, but I don't see how this would stop working. There's no way a
crossinline
lambda could allow suspension implicitly when you think about it.
d

dave08

01/11/2018, 3:48 AM
Hacks are hacks, even if it would work, the fact that someone else wouldn't understand how the code actually works is already code smell. I found myself looking at source code of well documented functions to reason about some case the devs didn't think about to see if it would work in my situation. Using undocumented/unintended functionality prevents that. You can disagree, but I know alot of people stay away from libs that do too much 'magic'.... 😉
l

louiscad

01/11/2018, 7:33 AM
Who said preventing suspension would prevent to document it?
d

dave08

01/11/2018, 8:26 AM
Didn't mean that, but I guess each one with their style and habits 🙂
5 Views