From: Bulat Ziganshin Date: 2002-10-01T23:09:49+09:00 Subject: Re: thoughts on typelessness Hello Dave, Tuesday, October 01, 2002, 6:00:35 PM, you wrote: >> For me, it is because I assume that my code user (sometimes including >> myself) will make mistakes, such as giving the code a String when a Fixnum >> is expected. Therefore, so that I can catch the error as early as >> possible (to give more useful hints to the user that it is his/her input >> that is wrong, not the code), I usually code >> >> def func (a) >> raise "type error" unless a.kind_of? Fixnum >> .... DT> Ruby types are not releated to classes. They're related to object DT> protocols (the infamous Duck Typing). That's what gives Ruby much of DT> its appeal. Testing for classes is really very poor style, and DT> artificially constrains the users of your code. there is tradeoff between flexibility and reliability. especially for such types as Fixnum ;) which has never to be emulated by some other class -- Best regards, Bulat mailto:bulatz@integ.ru