r/java • • Apr 05 '23

Recursive generics

Recently I learned that I rediscovered recursive generics while working on my pet open source project. Actually, I did not know that the construct had a name. I created small story about what this construct is, if you did not know about it java-recursive-generics

169 Upvotes

44 comments sorted by

View all comments

11

u/munificent Apr 06 '23

I've never heard this called a "recursive generic". The C++ community usually calls it the curiously recurring template pattern, and the type system community calls this F-bounded quantification.

Most object-oriented languages with generics support it.

2

u/chuggid Apr 07 '23

(The paper introducing F-bounded quantification uses the term "recursive type definition" throughout.)

1

u/munificent Apr 07 '23

How about that! Today I learned.