I think even in the frontend, the compiler try to guess the type beforehand, and anotate the real type for the compiler to optimize for the right type.
The problem is that i didnt dive that deep to know if a language as Python would be a good fit, nor im a "compiler guy" myself, so..
But i would love to do this as a backside project. The problem is my time is currently all taken by a big project.
But i would love to try to do this plug.. Thats why im winking here on HN. Maybe others also find a interesting thing to try themselves.