Comment by dudeinjapan
11 hours ago
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.
> First, YJIT/ZJIT do much better when they know the type signatures of methods.
The running interpreter knows the type of objects. Ruby isn't untyped.
The annotations do nothing for the interpreter.
YJIT and ZJIT don't use method annotations.