logoalt Hacker News

LtWorfyesterday at 10:16 AM1 replyview on HN

pypy existed long before type annotations were a thing


Replies

masklinnyesterday at 12:39 PM

And JITs often don't care for type specifications as they can generally get better info from the runtime values, need to support that anyway, and for languages like python the type specifications can be complete lies anyway. They also might support (and substitute) optimised versions of types internally (e.g. pypy has supported list specialisation for a long time).

Maybe it's changed since, but last I checked the JVM's JIT did not care at all for java's types.

Which is not to say JITs don't indirectly benefit mind, type annotations tend to encourage monomorphic code, which JITs do like a lot. But unlike most AOT compilers it's not like they mind that annotations are polymorphic as long as the runtime is monomorphic...

show 1 reply