voddan
09/26/2018, 5:00 AMorangy
delegate val listDelegate: List<Int> = target
looks interesting, however it has an issue: since listDelegate
can be accessed implicitly by calling into List<Int>
methods on this
, initialization order becomes a problem. When delegation expression is in the class header, you cannot sneak an init
block or something else between initialization of this property and potential access (excluding well-known “leaking this” problem, e.g. accessing it from base class)Dico
09/26/2018, 12:52 PMorangy
Dico
09/26/2018, 1:30 PM