From: Harry Ohlsen Date: 2001-12-12T08:03:47+09:00 Subject: [ruby-talk:28287] Re: The benefits of dynamic typing? In article , "Robert Feldt" wrote: > Something like > > class T > type_hint Integer, :m, Integer, Integer > def m(a,b) > a+b > end > end I assume what this means is that the method is intended to return Integer, and the arguments are both intended to be Integer, hence the VM is being asked to do appropriate conversions, if possible, if the actual arguments passed (or the return value) don't match? Ie, if I wanted T#fred to return String and take two arguments of types Fixnum and Float, I'd do something like ... class T type_hint String, :fred, Fixnum, Float def fred(a,b) a+b end end I think that's very nice. In particular, it would make writing classes for mathematical types nice and clean. At the moment, one needs to write a lot of short pieces of code to do coercions, just in case you want to mix your own types with already-existing ones.