logoalt Hacker News

dudeinjapantoday at 7:33 AM1 replyview on HN

Two reasons.

First, YJIT/ZJIT do much better when they know the type signatures of methods. You pay a performance penalty for implicit polymorphism, e.g. using a mix of types (Integer, Symbol, String) etc in the same method argument.

Second, from my experience with Typescript, as much as I naturally dislike type declarations, I find it does help LLMs. Having strongly typed libs/gems and being able to mix in untyped app code would be a nice balance.


Replies

tekknolagitoday at 3:11 PM

YJIT and ZJIT don't use method annotations.