From: "Hal E. Fulton" Date: 2002-10-02T09:02:05+09:00 Subject: Re: thoughts on typelessness ----- Original Message ----- From: "Dave Thomas" To: "ruby-talk ML" Sent: Tuesday, October 01, 2002 9:00 AM 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. How universal is this terminology, especially in Rubyland? After all, isn't #class basically a synonym for #type? Hal