Hello, I was gonna ask a question about delegation...
# announcements
d
Hello, I was gonna ask a question about delegation here but since it became too long i moved it to StackOverflow instead. If I may be so bold I will still link it there tho 😈 http://stackoverflow.com/questions/42669433/kotlin-how-are-a-delegates-get-and-setvalue-methods-accessed
r
I've answered on SO, but pasting the answer here as well for convenience: If you look at the generated Kotlin bytecode, you'll see that a private field is created in the class holding the delegate you're using, and the
get
and
set
method for the property just call the corresponding method on that delegate field. As the class of the delegate is known at compile time, no reflection has to happen, just simple method calls.
d
thanks for the heads up, leaving you a thumbs-up. Gna accept hotkey's answer though for the sake of the details he targets.
r
His answer is indeed way more elaborate, he must have been typing for some time already when I answered. Thanks! 👍