[Rails] 12 / 16 = 0

Jonathan Weiss jw at innerewut.de
Sun Apr 2 09:10:30 GMT 2006


Jeroen Houben wrote:
> Gábor SEBESTYÉN wrote:
>>
>> On 2006.04.02., at 10:16, Jeroen Houben wrote:
>>
>>> Just thought it was weird that Ruby doesn't automatically cast ints 
>>> to floats. Seems so un-rubyish

No, this is exactly why Ruby is a strong dynamically typed language. 
Doing autoconversion is a very bad thing as unintentioned things can happen.

If I tell the computer to dived two integers, I get an integer back. If 
I tell the computer to contatinate two strings I get a string back. If I 
tell the computer to add a string to a number Ruby should tell me "I 
can't do it".

That's the whole point abouot strongly typed languages!


Jonathan

-- 
Jonathan Weiss
http://blog.innerewut.de


More information about the Rails mailing list