From: Tony Arcieri Date: 2009-04-14T03:50:31+09:00 Subject: Re: Ruby vs. Groovy: your perspective --0016e6407ed02e159704677430cc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Mon, Apr 13, 2009 at 5:35 AM, Diego Virasoro wrote: > Still I've heard a bit about Groovy and it kind of seems like the Java > answer to Ruby (even the names are kind of similar). So I was > wondering if that kind of "first citizen" status will eventually make > it take over Ruby as a dynamic language (assuming that indeed that the > Groovy language offers everything Ruby does). > One of the most powerful Ruby idioms I know of requires features Groovy doesn't have. I'm talking about creating a small declarative "DSL" you call from a class body to metaprogram methods, such as with ActiveRecord associations, e.g.: class Foo < ActiveRecord::Base has_many :bars has_many :bazzes, :through => :quuxes, :order => "created_at DESC" end This allows for instances of Foo to potentially respond to many different methods based on the association names (e.g. you can call afoo.bars to get a collection of associated bars) Groovy does not allow code in class bodies (at least last I checked), and I believe Grails tries to work around this with static properties, which can't provide the full expressive power of a DSL. I've heard generally bad things about Groovy's approach to metaclasses and metaprogramming in general, but as I haven't used Groovy I can't really comment in that regard. -- Tony Arcieri --0016e6407ed02e159704677430cc--