Delegates are very useful but making disk I/O or network calls using delegates are highly discouraged. Instead use an scope.async { loadStuff() } and read it from a suspending function if you want to cache the result. The kotlin style guide explicitly discourages you from making most of your examples delegates or properties: kotlinlang.org/docs/reference/codi...
Lastly delegates are fairly expensive (they need to create a KProperty object for each property) and on performance sensitive platforms (such as Android) they should be used with care.
Great article though, they are a powerful tool that every Kotlin developer should have in their arsenal
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Delegates are very useful but making disk I/O or network calls using delegates are highly discouraged. Instead use an
scope.async { loadStuff() }
and read it from a suspending function if you want to cache the result. The kotlin style guide explicitly discourages you from making most of your examples delegates or properties:kotlinlang.org/docs/reference/codi...
Lastly delegates are fairly expensive (they need to create a
KProperty
object for each property) and on performance sensitive platforms (such as Android) they should be used with care.Great article though, they are a powerful tool that every Kotlin developer should have in their arsenal