I've been learning Groovy for one of my university modules this term. Is interesting. It compiles to java byte code, and uses Java class libraries, but is dynamic, flexible, and generally completely unlike Java itself. And it has closures, which I've never really used before, but which I can see myself really growing to like.
The lecturer claims that Groovy is going to be built in to Java 1.7 (or should that be 7.0?), though I can't find anything on t'internet to back this up.
Of course, Groovy isn't the first scripting language that compiles to Java byte code. We've already got Jython, Jruby, BeanShell... etc. Groovy's developers say that it's "more similar to Java syntax" than other scripting languages, but I'm not so sure — to me, it looks more Python-like than anything else. (Albeit with braces). 8^)
Here's a bit of Groovy (from this page on the Groovy main site):
Anyone else come across Groovy before?
The lecturer claims that Groovy is going to be built in to Java 1.7 (or should that be 7.0?), though I can't find anything on t'internet to back this up.
Of course, Groovy isn't the first scripting language that compiles to Java byte code. We've already got Jython, Jruby, BeanShell... etc. Groovy's developers say that it's "more similar to Java syntax" than other scripting languages, but I'm not so sure — to me, it looks more Python-like than anything else. (Albeit with braces). 8^)
Here's a bit of Groovy (from this page on the Groovy main site):
class Employee {
def salary
}
def highPaid(emps) {
def threshold = 150
return emps.findAll{ e -> e.salary > threshold }
}
def emps = [180, 140, 160].collect{ val -> new Employee(salary:val) }
println emps.size()
println highPaid(emps).size()
Anyone else come across Groovy before?
Tags: