Y
Hacker News
new
|
ask
|
show
|
jobs
by
sethammons
1734 days 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.
1 comments
acchow
1733 days ago
This 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.
link
But if you need type parameters, then you wouldn't be able to do this.