From: gabriele renzi Date: 2004-03-25T19:54:26+09:00 Subject: About type inference for ruby Hi gurus and nubys, I'm going to put some memes toghether running away in few minutes, to see what the community thinks. I just run across this paper[1] from latest PyCon that explains a way to compile Python to actually efficient C++ using automatic type inference. I remember matz and others were someway interested in Type/interface inference, (see this[2] and this[3]) and I, FWIW, would love to see type inference in ruby. It seem that in the thread referenced by [3] matz pointed out that stuff like this: def whatiwould(x, flags) if flags x = Regex.new(x.join("|")) end x.match(@str) end would be actually too hard to analyze for interface/duck signature inference. And this relates to blogging from PragDave[4] and Chad Fowler[5] I which appears the interesting meme that "we don't want to check variable usage anytime, we would just check that once a variable has a type, it does not change substantially". Actually I believe too, that you don't need and should not do x=12 x='str' Would it make sense to have a flag to say to the interpreter "raise an exception if this variable gets a new assignment" and then do type inference? [1] http://www.python.org/pycon/dc2004/papers/1/paper.pdf [2] http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/1437?1215-1527+split-mode-vertical [3] that's a *huge* thread.. http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/85890 [4] http://www.pragprog.com/pragdave/Tech/Ruby/LazyType.rdoc [5] http://www.chadfowler.com/index.cgi/Computing/Programming/Ruby/TypeWatching.rdoc,v