From: Premshree Pillai Date: 2005-01-10T00:47:37+09:00 Subject: Re: Type inference in ruby On Sun, 9 Jan 2005 04:16:36 +0900, Eric Anderson wrote: > 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 Your sentence seems ambiguous. What exactly do you mean by it? _All_ languages are either strong typed or weak typed. > the reasons I left those other languages. For me a type system has too I think that's the same reason most people love dynamic languages like Python and Ruby. Both of them are also strong typed. I like that. However, a lot of people favor static typing. There has been discussion going around to implement optional static typing in Python. There's also pychecker (http://pychecker.sf.net/) for Python for syntax error checking and stuff that wouldn't have been caught by the interpreter itself. Wonder if there's something like this for Ruby. :-w > 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. > > Just my two cents, > > Eric > > -- Premshree Pillai http://www.livejournal.com/~premshree