Groovy developers team preparing for us a few important surprises.
They added more AST transformations, for different cases like
@Canonical, @EqualAndHashCash, @ToString
and many others. You may use such annotations to generate toString(), equals(), hashCode()
methods on compilation. @InheritConstructors helps to generate inherit all parent constructors, and here is link to task.Another interesting feature is Closure composition, so now it's possible to use special syntax to compose multiple closures, like:
def log = { a -> println(a); a }
def save = { a -> dao.save(a); a}
def notify = { a -> notificationService.notify(a); a }
// so now instead of calling notify(save(log(user)))
// you may call it like
def action = log >> save >> notify
action(user)
// or even like
notify << save << log << user // is that awesome or awful?!
Also they prepared few performance improvements: avoiding calling methods when it's not necessary and processing operations on integers as primary type values but not objects (like, incrementing or adding). As result Groovy can be used for mathematical calculations without performance issues. In this presentation you can read much more about this. And here are related jira tasks so anyone can watch the progress.
This issue is fixed so they can't say that "Ruby is right, Groovy is wrong" anymore :)
Annotations now can accept closure as argument:
@Validator { password.size() > 6 }
String password
This task contains more information and links.
Closure currying is a powerful thing. And now it's possible to curry right and 2nd (of three) parameter. Moreover no need to wait Groovy 1.8 to try this, because it's available right now and right here, starting from version 1.7.2 of course ;)
Well, that's all about this for now. Waiting for Groovy 1.8 and for more interesting things to be released this December.