From: Bulat Ziganshin Date: 2002-10-02T14:58:30+09:00 Subject: Re: thoughts on typelessness Hello Dave, Tuesday, October 01, 2002, 7:07:43 PM, you wrote: DT> William Djaja Tjokroaminata writes: >> Really, I want the 'rate' and 'delay' to be of class Float and nothing >> else. >> Can you provide some idea on how to better deal with user input error >> using probably some Ruby paradigm? DT> Perhaps: DT> def my_method(rate, delay, ...) DT> wibble(rate.to_f, delay.to_f, ....) DT> Here you're not insisting that 'rate' and 'delay' are floats, but DT> instead that they can yield float values: that they can behave as DT> floats. Yes! integers may be used too. but on the other hand, ruby don't support automatic type conversion. some type can be easily converted to Float, but don't support addition to Float: def myFloat def to_f 1.0 end def +(x) @size+x.size end end -- Best regards, Bulat mailto:bulatz@integ.ru