Re:Crystal 1.0 – What to expect
by astrowilson on Monday March 22, 2021 @04:33PM
(#26546533)
It is still global. Typing collections and instance/class variables help, you can optionally type methods, but anything that is not explicitly typed is going to be inferred during invocation and that needs to happen based on all callers in the whole program. Reducing the amount of type variables do not eliminate the global behavior.
In contrast, local inference considers a predefined context, such as the current module or class, and is much faster, easier to cache, etc.
You might know a lot more than me about the subject, so feel free to correct me, but I think it used to be truly global inference - as in you were expected to write the whole program with no annotations. But now you're required to annotate instance and class variable types, because compile times were becoming intractable.