logoalt Hacker News

dalvrosayesterday at 9:50 PM1 replyview on HN

Nice one, TIL

One caveat with "hash vtables" is that you only really see a performance win when the interface has a lot of specializations.


Replies

hinkleytoday at 12:12 AM

As I just mentioned in another reply, the problem they were trying to solve was hierarchies where it makes sense for a group of types to be constructed by the combination of two or three narrowly scoped interfaces.

For instance, if you treat some collections as read only, you can define comprehensions across them with a single implementation. But that means the mutators have to be contained in another type, which a subset will implement, and may have covariant inputs.