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):

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?
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

.

Profile

spudtater: (Default)
spudtater

Most Popular Tags

Powered by Dreamwidth Studios

Style Credit

Expand Cut Tags

No cut tags