From: Dave Thomas Date: 2002-08-28T04:12:06+09:00 Subject: Re: compile time type checking "Volkmann, Mark" writes: > I'm curious how some of you that have written real applications in Ruby have > dealt with this. Don't you have problems where an application crashes on a > user because the wrong type of object gets passed to a method and it tries > to invoke a method of the object that it doesn't have? ... > I love Ruby syntax, but this issue may be one that keeps many people using > Java instead. But Java has run-time type checking as well. Consider an average running Java program. How many objects are extant? 1,000? 2,000? How many variables do you have? 20? 30? So, where are all the other objects? In collections. And how do you get to them? By casting at every access. The type gets discovered at run time. How many class cast exceptions do you see in Java? In reality, not many. In the same way, I don't often see the wrong kind of object being used in Ruby. However, to ensure that, I have to exercise the various paths through the code, so I rely on unit tests to give me the confidence that my code is reasonable. Cheers Dave