3 ms·
All discussions of generic types seem to end at recursive types “type T[P T[P]]”. I don’t know if Go has an equivalent “super” operator, but in Java you can de
by vimax 3y ago
All discussions of generic types seem to end at recursive types “type T[P T[P]]”.
I don’t know if Go has an equivalent “super” operator, but in Java you can define:
class Type<T extends Type<? super T>>
Which puts an upper and lower bound on T. It has some interesting behavior with inheritance but I haven’t found it discussed anywhere.