From: E S Date: 2005-01-09T04:35:08+09:00 Subject: Re: Type inference in ruby > L�hett�j�: Eric Anderson > Aihe: Re: Type inference in ruby > > Trevor Andrade wrote: > > I was wondering whether it would be possible to have a type inference system > > in ruby. My question was asked before > > I am sure it is possible to implement but I think most people end up > wondering why do it? If you want a typed system (strong or weak) there > are plenty of languages that support it natively. For me that is one of > the reasons I left those other languages. For me a type system has too > much coding overhead without much benefit. The two advantages are: > > * Catches type errors > * Possibly better optimizations > > To answer the first advantage Ruby encourages Unit testing. Unit testing > it 10 times better than type checking because it can not only check for > valid types but also check for logic errors. So why spend the overhead > of a type system when unit testing is better. > > The second advantage again isn't an issue for me. Ruby is fast enough. > If I need it faster I can profile the code to find bottlenecks. If I > need it even faster I can recode the bottlenecks in C. Again, the > overhead of a type system is not worth even the possibility of better > optimizations. A TI system could be implemented as a separate library to be run on some code rather than as a part of that code, as an additional testing facility. That being said, I think it may be too much trouble for little gain. > Just my two cents, > > Eric E