Does anyone know is there some ruby configurations that can be done to
ruby act a little more like a statically typed languageâ?¦â?¦â?¦I love its
nature, but miss the safety that comes from statically typed languages
Can you elucidate a little ? What kinds of things do you feel are less
safe in your ruby code than in your java code ?
If it’s about the type of args, I suppose you could check that an object
passed in responds to all the messages you’re planning to send, and
raise early. I don’t think you can statically check that kind of
stuff prior to runtime, but could be wrong. You might be better in the
ruby-talk list as this is more ruby-ish question, than a rails question.
For my own part, I too was nervous, until I realised that I never got
compile errors (due to incorrect types) in my Java, so didn’t miss them
in Ruby. The only place I did get occasional errors was in the
monumental XML config required for our Spring/iBATIS app. That XML
config meant I wasn’t informed about type errors until runtime, just
So, occasional type errors, not discovered until runtime was equally
true in Java and Ruby for me. YMMV, of course, but it’s worth asking
the last time the compiler caught a typing bug for you.