Type Inference for Constants
By Erno Mononen on Apr 17, 2009
Martin implemented several type inference improvements for 6.7, but since he hasn't blogged about any of those and I've now continued his work in this area I thought I'd mention some of them in this blog. Basically credit me for everything that works smoothly, for bugs please blame Martin. There's quite a lot of stuff and I have just so much time and patience to write one blog entry, so this will be more like a series. For the uninitiated, type inference (hereinafter just TI) means that the IDE tries to infer the types of values, which, thanks to the dynamic nature of Ruby, can be a bit tricky at times. Let's first take a look at TI for constants. Top-level constants: (ARGV is an Array, hence the code completion dialog shows just the appropriate methods for it.) (STDOUT is an instance of IO.) Constants from other modules/classes: (Date::ITALY is a number.) And finally, local constants: That's it for constants, in the next installment of the series I'll talk about TI for methods.