From: Dave Thomas Date: 2002-10-01T23:00:35+09:00 Subject: Re: thoughts on typelessness William Djaja Tjokroaminata writes: > Hi, > > 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 > .... Ruby types are not releated to classes. They're related to object protocols (the infamous Duck Typing). That's what gives Ruby much of its appeal. Testing for classes is really very poor style, and artificially constrains the users of your code. Dave