There is definitely something to be said for early checks, but there's also definitely a use for the extra rope a dynamic language gives you. Take a look at all of _why's ridiculously cool metaprogramming tricks (and, actually, a lot of the code for Rails) for examples of things that would drive a sanity checker crazy. Dealing with singleton methods, metaclasses, methods that don't even exist (via method_missing) and passed-around code blocks is probably doable, but it would certainly take a lot of doing.
Ruby does have some error checking, but due to the lack of a compile time, they're not automatically run for you in the process of making the program. In your particular case, the error Ruby gave was about as good as any you'd get in a C compile-time check: "No such method or variable: 'photo'".
by Chuck — Dec 24
Ruby does have some error checking, but due to the lack of a compile time, they're not automatically run for you in the process of making the program. In your particular case, the error Ruby gave was about as good as any you'd get in a C compile-time check: "No such method or variable: 'photo'".