The second time I have taken a deeper look at Groovy (this happened sometime last year), there were a couple of things about its meta programming capabilities that even if looking good were not so easy and not so advanced as the offerings in other languages.
At that time, I’ve looked at what other languages (like Ruby, Python, etc.) were offering in this field and I have tried to sell them to the Groovy dev team. But, due to the lack of time I had to stop after a while.
Fortunately enough, Graeme Rocher, project lead of Grails, have been constantly pushing for most of those proposals and even for more advanced/useful features. And now, with the release of Groovy beta3 I can say that Groovy has just got the best meta programming elements.
Well, I am not gonna present them here because they are already very well documented on the Groovy site:
- Using invokeMethod and getProperty
- Using methodMissing and propertyMissing
- Evaluating the MetaClass runtime
- Using ExpandoMetaClass to add behaviour
- Customizing MetaClass for a single instance
The whole Groovy team is wishing you: Happy Groovying!
PS: Yes, I agree that using the word “best” is gonna make my statement arguable (and probably it is ), but I truely believe that Groovy offers now a wonderful meta programming environment.
Update: I have posted a while ago a couple of links about meta object protocol.