https://kotlinlang.org logo
#feed
Title
# feed
v

vishna

06/03/2019, 11:47 AM
Hi, I wrote an article about Kotlin & WatchService - an example how to wrap existing Java API with Kotlin - a practical use of some language features such as: extensions, channels, sealed classes & implementation by delegation. https://medium.com/@vishna/kotlin-watchservice-a-better-file-watcher-using-channels-coroutines-and-sealed-classes-7ab5c9df3ada
👍 3
o

obobo

06/03/2019, 2:11 PM
This was pretty neat, I'm just not sure I agree with your use of sealed classes. The way you used them (entirely constant) seems like you'd be better off with enums.
2
v

vishna

06/03/2019, 3:02 PM
Good point. I want to believe though we only have enums in Kotlin because of the Java inter-op 🙂
a

altavir

06/03/2019, 4:27 PM
Enums are syntactically shorter and much lighter in terms of VM.
v

vishna

06/04/2019, 6:30 AM
guess it might be an overkill, gonna update that
fixed, thanks for feedback
👍 1
11 Views