AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
How to Improve Generic Type Inference
One thing that I am looking forward to in one one 21 is some improvements to generic type inference. So if you've got a function, a less generic, less function that automatically knows how to compare two comparable types, for example, and you pass that to something they expects another generic function, then you don't have to mention you don't need to instantiate it. It's infer from where you're assigning it to the type parameter for the function. That's pretty cool,. particularly in the context of things like slices, sort, funk, and that sort of thing. You just want to be like, I'd like all of these things to be garbage collected, but I still want