kevin.cianfarini
05/04/2025, 3:11 AM// An interface in code I define.
interface Thing { ... }
// A type from a third party library.
class SomeThirdPartyType
// An implementation of Thing based on the public API of SomeThirdPartyType that I own.
extension SomeThirdPartyType : Thing { ... }
A really naive implementation of this could generate some wrapper like SomeThirdPartyType$ThingImplWrapper
that, whenever an instance of SomeThirdPartyType
is referenced as a Thing, it is boxed by the generated wrapper.
Are there unsuspecting ways which something like this might actually be terrible?Youssef Shoaib [MOD]
05/04/2025, 3:12 AMkevin.cianfarini
05/04/2025, 3:15 AMkevin.cianfarini
05/04/2025, 3:38 AMYoussef Shoaib [MOD]
05/04/2025, 3:39 AMinterface Thing<T>
and make every operation an extension on T, then you'd take in a Thing context everywhere you want those operations. This is like type classes in other languageskevin.cianfarini
05/04/2025, 1:39 PMinterface Thing<T> {
fun T.doThing()
}
kevin.cianfarini
05/04/2025, 1:41 PM