From: Robert Klemme Date: 2005-10-20T00:21:58+09:00 Subject: Re: Advantages of Ruby rjack@elegancetech.com wrote: > I am new to Ruby. I have done most of my development in statically > typed languages (Java, C++, C#, etc.). > > I understand that there are advantages and disadvantages to dynamic > versus static typing. What idioms/patterns can you do in Ruby that you > just can't do in statically typed languages? One of the major advantages is that you get polymorphism without the need to make types compatible (via a common interface like in Java for example). In Ruby you can easily do something like this: f = lambda {|x| puts "calc...";x ** x} if do_it_fast? calc = Hash.new do |h,k| h[k] = f[k] end else calc = f end puts calc[10] puts calc[10] i.e. you can use a Hash and a lambda interchangably. Basically, you gain a lot of flexibility. > Are there problems you > can solve in Ruby that you can't solve or would be awkward to solve in > statically typed languages? I don't think this is about issues not being solvable but about needing more or less lines of code (which directly impacts productivity and likeliness of bugs). Kind regards robert