Forum: Ruby on Rails Ducktyping ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8c96651183503cbf34df70eae933d22e?d=identicon&s=25 JackBrody (Guest)
on 2006-04-27 20:18
(Received via mailing list)
Hi,
Does anyone know is there some ruby configurations that can be done to
make
ruby act a little more like a statically typed language���I love its
dynamic
nature, but miss the safety that comes from statically typed languages
like
java��.

Cheers in advance

--
View this message in context:
http://www.nabble.com/Ducktyping-ruby-t1519743.html#a4126192
Sent from the RubyOnRails Users forum at Nabble.com.
4daf0b71d5d9a3882e583c0e72eaf5dc?d=identicon&s=25 Alan Francis (Guest)
on 2006-04-27 23:51
JackBrody wrote:
> Hi,
> Does anyone know is there some ruby configurations that can be done to
> make
> ruby act a little more like a statically typed language���I love its
> dynamic
> nature, but miss the safety that comes from statically typed languages
> like
> java��.

Hi jack,

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
like Ruby.

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.

A.
This topic is locked and can not be replied to.