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

spand

09/28/2018, 9:01 AM
Has kotlin versions of Guardedby, Immutable, NotThreadSafe and ThreadSafe annotations been considered ? With associated compiler / ide support that is ?
e

elizarov

09/28/2018, 9:39 AM
What kind of compiler / ide support you are looking for? The last time I’ve checked it was an open (unsolved) research problem in computer science on how to integrate these kinds of things into compilers. There are a few research langs that attempt to “solve” it in some way, but with serious limitations
If there was any recent breakthough, we’d be more than happy to apply it
s

spand

09/28/2018, 9:47 AM
Heh. Not aware of any such breakthroughs 😉
But I assume it would not be difficult to issue warnings if private vals marked with GuardedBy are not wrapped in a call to withLock
Maybe I recall incorrectly but I think this exists for Java in IDEA
e

elizarov

09/28/2018, 9:51 AM
Maybe. Anyway, we are not in Java. With coroutines you have little need for synchronization of mutable state. You can share state by communicating, which is a much safer/saner approach to concurrency
35 Views