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?
gominokouhai: (Default)

From: [personal profile] gominokouhai


tef has recommended it to me before now. It seems quite interesting.
digitalraven: (Default)

From: [personal profile] digitalraven


Not seen it before now, but I like the look of it.

From: [identity profile] figg.livejournal.com


I've seen groovy before, it looks like a nicer way to prototype for java.

I haven't used it yet, it has yet to mature. That and I don't need to prototype stuff in java.

Groovy is being standardised as JSR-241, as part of the java community process. I think that might be the nearest thing to 'being built in'

p.s. even javascript has closures :)

http://jcp.org/en/jsr/detail?id=241
ext_79424: Line drawing of me, by me (Default)

From: [identity profile] spudtater.livejournal.com


What do you mean by "mature"? 1.0 has just been released, if that means anything.
.

Profile

spudtater: (Default)
spudtater

Most Popular Tags

Powered by Dreamwidth Studios

Style Credit

Expand Cut Tags

No cut tags