But the language is essentially frozen in the existing standard, and can only be extended by community consensus right now.
Is there a CLOS implementation with inline caches for generic method dispatch?
Even if you know all the types, you still have polymorphism that can’t be efficiently monomorphized without an exponential space penalty.
> you still have polymorphism that can’t be efficiently monomorphized without an exponential space penalty.
Wouldn't it be linear at each call site only by the number of types that actually reach that call site? Plus you don't have to cache _all_ types at the call site, only the most frequent ones.
In Java and JS for instance, dynamic dispatch is JITed away at hot spots, and can be un-jitted later to reclaim space if the spot is no longer hot.
I generally don't care if a dynamic dispatch is slow if I'm only calling it a few times, but in a tight loop I want it to be inlined as much as possible.
You've put into words something I've struggled with saying for a while, and the exact reason I could never really enjoy working with Common Lisp.
The example I always return to is the lack of pervasive use of CLOS throughout the standard. Something like generic-cl[0] feels like it should be a baseline part of the language. As it is, it's a great library. But people are hesitant to even use it, because the result of making everything generic is a loss in performance!
Of course, [0] talks about optimizations they've done. I don't know how it compares to using the methods in the standard as opposed to the lib. Regardless, these libs only help when writing code, not reading it. Though don't get me wrong, that's a big deal! It's very helpful! But you wish everyone would play by those rules.
[0] https://github.com/alex-gutev/generic-cl