3 ms·
What you'd end up doing is copying and pasting a lot of code. You'd need to define one kind of proxy object for one type in the third-party library, and another
by oalae5niMiel7qu 5y ago
What you'd end up doing is copying and pasting a lot of code. You'd need to define one kind of proxy object for one type in the third-party library, and another kind for another type, and so on. Each would need to implement all the methods, with correct type signatures.
Perhaps you could parse the source code to the third-party library and generate matching proxy objects from that.
No number of compiler tricks would allow you to define a single object that can be a proxy for anything using a statically-typed language.