kyonifer
12/30/2016, 9:26 PMclass A : B by C() {
// need to access state inside the object C() returned, or functionality in C that isnt defined in B
}
Options I know of:
1) pass in a C instance to the constructor of A with a default, but this leaks implementation details to the API
2) use A::class.java.getDeclaredField("\$\$delegate_0")
, but thats a mess and probably not reliable in the future
3) use inheritance, but I generally dislike abusing inheritance for problems that arent really hierarchies
Unless I'm overlooking another option, it would be rather useful to give access to the delegate somehow (this.'$delegate'?), to enable using delegation over inheritance for problems that dont make sense w/ inheritance and really want a trait (i.e. A is not a type of C, but it is an implementation of B).