Type Inference for Constants

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.

Comments:

> Basically credit me for everything that works smoothly, for bugs please blame Martin.

:)) Sure, it is vice-versa. Everything worked smoothly, so in case of any bugs, those are Erno's enhancements ;)

Posted by Martin Krauskopf on April 17, 2009 at 08:28 AM CEST #

Post a Comment:
Comments are closed for this entry.
About

emononen's blog

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today