3 ms·
instead of taking an empty interface, take an interface with defined methods. Then the caller can conform their type to whatever the API needs.
by sethammons 5y ago
instead of taking an empty interface, take an interface with defined methods. Then the caller can conform their type to whatever the API needs.
- acchow 5y agoThis is what people due when generic types (parametric polymorphism) wouldn't be involved. But if you need type parameters, then you wouldn't be able to do this.